From a31f7db619f8e9f06dcacfcc22a52fc1212f8f97 Mon Sep 17 00:00:00 2001 From: Mistral Vibe Date: Mon, 6 Apr 2026 19:32:27 +0200 Subject: [PATCH] Fix API dev: use pip editable install instead of uv run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit uv run spawns uvicorn, which uses multiprocessing.spawn for hot reload. The spawned subprocess starts a fresh Python interpreter that bypasses uv's venv activation — so it never sees the venv's packages. Fix: use a standalone python:3.12-slim dev stage with pip install -e . directly into the system Python. No venv means the spawn subprocess uses the same interpreter with the same packages. The editable install creates a .pth file pointing to /app/src, so the mounted host source is live. Co-Authored-By: Claude Sonnet 4.6 --- api/Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/api/Dockerfile b/api/Dockerfile index 239b614..7a0ac92 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -2,14 +2,15 @@ FROM python:3.12-slim AS base WORKDIR /app RUN pip install uv -FROM base AS development -# python:3.12-slim has no bare 'python' binary; without this uv invalidates the baked venv on every start -RUN ln -sf /usr/local/bin/python3 /usr/local/bin/python +FROM python:3.12-slim AS development +WORKDIR /app COPY pyproject.toml . COPY src/ src/ -RUN uv sync -COPY . . -CMD ["uv", "run", "uvicorn", "rehearsalhub.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] +# Install directly into system Python — no venv, so uvicorn's multiprocessing.spawn +# subprocess inherits the same interpreter and can always find rehearsalhub +RUN pip install --no-cache-dir -e "." +# ./api/src is mounted as a volume at runtime; the editable .pth file points here +CMD ["python3", "-m", "uvicorn", "rehearsalhub.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] FROM base AS lint COPY pyproject.toml .