From 728ab2e8fda210170d8cd144ae40b68e884f68dd Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Mon, 2 Mar 2026 09:19:48 +0000 Subject: [PATCH] Pre-install common Python packages in workspace venv and warm Docker cache Install httpx, fastapi, uvicorn, requests, flask, pydantic, numpy, pandas, matplotlib, pillow, jinja2, pyyaml and more on workspace creation. Also pre-warm uv cache in Dockerfile so first project setup is near-instant. uv's global cache (~/.cache/uv/) is shared across all project venvs. Co-Authored-By: Claude Opus 4.6 --- Dockerfile | 2 ++ src/agent.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0539d5b..1d29bb6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,8 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | sh ENV PATH="/root/.local/bin:$PATH" RUN uv venv --python 3.12 /app/venv && uv pip install --python /app/venv/bin/python sentence-transformers RUN /app/venv/bin/python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" +# Pre-warm uv cache with common packages (shared across all project venvs) +RUN uv pip install --python /app/venv/bin/python httpx fastapi uvicorn requests flask pydantic numpy pandas matplotlib pillow jinja2 pyyaml python-dotenv beautifulsoup4 lxml aiohttp aiofiles pytest rich click typer sqlalchemy RUN mkdir -p /app/data/workspaces WORKDIR /app COPY target/aarch64-unknown-linux-musl/release/tori . diff --git a/src/agent.rs b/src/agent.rs index c9d52ce..d7ccdac 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -257,6 +257,7 @@ async fn ensure_workspace(exec: &LocalExecutor, workdir: &str) { let venv_path = format!("{}/.venv", workdir); if !Path::new(&venv_path).exists() { let _ = exec.execute("uv venv .venv", workdir).await; + let _ = exec.execute("uv pip install httpx fastapi uvicorn requests flask pydantic numpy pandas matplotlib pillow jinja2 pyyaml python-dotenv beautifulsoup4 lxml aiohttp aiofiles pytest rich click typer sqlalchemy", workdir).await; } } }