Repository navigation
feat: Add python-uv template - #800
Conversation
Adds a "Manage your project with uv" guide covering the whole Actor lifecycle with the [uv](https://docs.astral.sh/uv/) package and project manager: creating a project, the Actor scaffolding, running locally, installing the locked dependencies in the Dockerfile, deploying, and day-to-day dependency management. - `docs/03_guides/10_uv.mdx` — the guide. - `docs/03_guides/code/uv_project/` — the backing example project, covered by the repo lint and type checks. - Quick-start guides list updated. The documented flow was verified end to end (local `apify run` + a real Docker build/run). Since the Actor templates are pip-only for now, the guide carries an info banner pointing to apify/actor-templates#350. Companion template PR: apify/actor-templates#800.
5f9af0d to
845fd1c
Compare
`apify create` hard-coded `pip install -r requirements.txt` for Python Actors, so creating a uv-managed template — which ships `pyproject.toml` + `uv.lock` and no `requirements.txt` — failed during dependency install with `Could not open requirements file`. `create` now detects uv-managed Python/Scrapy projects by the presence of a committed `uv.lock` and installs their dependencies with `uv sync` instead. The check runs before the system-Python detection, since uv provides the interpreter pinned in `.python-version` itself, and falls back to a warning with install instructions when the `uv` executable isn't found. This unblocks the upcoming `python-uv` template (apify/actor-templates#800).
2615dc0 to
df91f79
Compare
apify-factory
left a comment
There was a problem hiding this comment.
AI code review — python-uv template
Verdict: The PR delivers what it sets out to do. There is no linked issue; judged against its own description, the new python-uv template is well-built and mostly follows the established template conventions (layout, Dockerfile, apify>=4.0.0,<5.0.0 pin, base image, test wiring). I checked the Docker permission angle (root user → compileall and .venv writes succeed) and the SDK-version pin/test interaction — both are fine. No blocking correctness or security issues. The findings below are convention divergences worth a second look before merge; none are merge-blockers, and a human makes the final call.
| # | Location | Issue | Severity |
|---|---|---|---|
| 1 | .actor/actor.json:13-14 |
Uses input/output keys; the other 34 templates use inputSchema/outputSchema |
medium |
| 2 | test/templates.test.js:183 |
uv playwright branch installs all 3 browsers; pip path restricts to chromium | low |
| 3 | .gitignore:6 / .dockerignore:9 |
.env/ directory entry looks unintended |
nit |
l2ysho
left a comment
There was a problem hiding this comment.
thx @vdusek, pre- approved, pls check if @apify-factory review findings are valid
Adds a
python-uvActor template - Actors built and run with uv.Template
pyproject.toml+ committeduv.lockand.python-version. Identical versions locally and in the platform build.uv sync --locked --no-devin a cached layer.python-start, so only the project management differs..gitignore/.dockerignore: keepuv.lock, never ship.venv.Infrastructure
test/templates.test.js:checkPythonTemplatedispatches onuv.lock. uv templates install viauv sync --upgrade. pip flow unchanged.test_python_templates.yaml: addedastral-sh/setup-uv, no Python input, so.python-versionstays authoritative.Verified
python-uv.python-emptypasses as a pip control.Related PRs