Skip to content

feat: Add python-uv template#800

Draft
vdusek wants to merge 1 commit into
masterfrom
feat/python-uv-template
Draft

feat: Add python-uv template#800
vdusek wants to merge 1 commit into
masterfrom
feat/python-uv-template

Conversation

@vdusek
Copy link
Copy Markdown
Contributor

@vdusek vdusek commented Jun 3, 2026

Description

Adds a python-uv Actor template - an example of building and running Actors with the uv package and project manager:

  • pyproject.toml + committed uv.lock and .python-version, so local development and the platform Docker build use identical dependency versions,
  • a uv-based Dockerfile (uv binary from its official image, uv sync --locked --no-dev in a cached dependency layer),
  • the same single-page heading scraper as python-start (HTTPX + BeautifulSoup), so the two templates are directly comparable - only the project management differs,
  • uv-aware .gitignore/.dockerignore (keep uv.lock and .python-version committed, never ship .venv).

Infrastructure changes:

  • test/templates.test.js: checkPythonTemplate now dispatches on the presence of uv.lock - uv-based templates install dependencies via uv sync --upgrade (mirroring the requirements.txt flow, which also always installs the latest allowed versions) and the latest-SDK assertion stays in place. The pip flow is unchanged.
  • test_python_templates.yaml: added astral-sh/setup-uv (without a Python version input, so the template's .python-version stays authoritative).

Verified locally: the jest template test passes for python-uv (structure, uv install + latest-SDK check, apify run scrapes and exits 0), python-empty passes as a pip-flow control, and the Docker image builds and runs end to end. The dist archive is intentionally not included - the master automation builds and commits it after merge.

Known limitation: apify create currently hard-codes pip install -r requirements.txt for Python templates, so creating this template via the CLI errors after extraction (the project folder survives and uv sync + apify run work fine - apify run already picks up the uv-created .venv). The manifest's postCreate message points users at uv sync, and --skip-dependency-install avoids the error entirely. A follow-up in apify/apify-cli (run uv sync when uv.lock is present) would close this gap.

Companion documentation PR: apify/apify-sdk-python#932 (new "Use uv" SDK guide linking this template).

🤖 Generated with Claude Code

Add a Python Actor template managed by the uv package manager - pyproject.toml
with a committed uv.lock, a uv-based Dockerfile, and the same single-page
scraper functionality as python-start for easy comparison. The template tests
now dispatch on uv.lock and install dependencies with uv for uv-based
templates.
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jun 3, 2026
@vdusek vdusek self-assigned this Jun 3, 2026
@github-actions github-actions Bot added this to the 142nd sprint - Tooling team milestone Jun 3, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Jun 3, 2026
@vdusek vdusek marked this pull request as draft June 4, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants