Skip to content

docs: Add uv guide#932

Open
vdusek wants to merge 4 commits into
masterfrom
docs/uv-guide
Open

docs: Add uv guide#932
vdusek wants to merge 4 commits into
masterfrom
docs/uv-guide

Conversation

@vdusek
Copy link
Copy Markdown
Contributor

@vdusek vdusek commented Jun 3, 2026

Description

Adds a new "Manage your project with uv" guide to the Guides section - a tutorial covering the whole Actor lifecycle with the 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.

The backing example project lives in docs/03_guides/code/uv_project/, is covered by the repo lint and type checks, and 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.

TODO before merging

  • After review, clone the guide content (docs/03_guides/08_uv.mdx + docs/03_guides/code/uv_project/) to website/versioned_docs/version-3.4/ as well, so it shows up in the current docs version and not only under "next".

🤖 Generated with Claude Code

Add a new guide on managing Actor projects with the uv package manager,
covering project setup, local development with the Apify CLI, the uv-based
Dockerfile, deployment, and dependency management.
@vdusek vdusek requested a review from szaganek as a code owner June 3, 2026 17:57
@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
@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
@github-actions github-actions Bot added this to the 142nd sprint - Tooling team milestone Jun 3, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.87%. Comparing base (b7ba52d) to head (d5ab731).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #932      +/-   ##
==========================================
- Coverage   86.94%   86.87%   -0.07%     
==========================================
  Files          48       48              
  Lines        2942     2942              
==========================================
- Hits         2558     2556       -2     
- Misses        384      386       +2     
Flag Coverage Δ
e2e 37.55% <ø> (ø)
integration 58.90% <ø> (ø)
unit 75.62% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek marked this pull request as draft June 3, 2026 18:00
@vdusek vdusek removed the request for review from szaganek June 3, 2026 18:00
…n uv guide

The scaffolding section referenced a Dockerfile that is only created later in
the guide, which was confusing without a pointer. The local run example also
used the optional --purge flag, which is not needed for the tutorial flow.
@vdusek vdusek marked this pull request as ready for review June 3, 2026 18:22
"Use uv" was too terse - unlike the scraping-library guides, the tool name
alone does not convey the guide's purpose. The new title mirrors the guide's
intro sentence and the verb-first sidebar convention.
@vdusek vdusek added the documentation Improvements or additions to documentation. label Jun 3, 2026
@vdusek vdusek requested review from Mantisus and szaganek June 3, 2026 18:25
@vdusek
Copy link
Copy Markdown
Contributor Author

vdusek commented Jun 3, 2026

It would be great if @Mantisus could review the overall Python correctness (and factual accuracy?), and @szaganek could review the content. Thank you guys 🙂.

# layer. The cache mount speeds up repeated builds, and the bind mounts make the
# project metadata available without copying it into the image. This layer is
# rebuilt only when uv.lock or pyproject.toml change - not on source code edits.
RUN --mount=type=cache,target=/root/.cache/uv \
Copy link
Copy Markdown
Collaborator

@Mantisus Mantisus Jun 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested it on the platform?

A few months ago, the --mount= options weren't supported for building containers on the platform.

The guide pointed readers to a python-uv template that isn't published. An
info banner now explains templates are pip-only for now and links the
tracking issue apify/actor-templates#350.
Copy link
Copy Markdown
Collaborator

@Mantisus Mantisus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few points

Comment thread docs/03_guides/08_uv.mdx

- The lockfile guarantees that the dependencies installed in the Actor's Docker image are exactly the ones you developed and tested against locally.
- Dependency installation during the Docker build is significantly faster than with pip, especially with a warm cache.
- A single tool manages your Python interpreter, virtual environment, and dependencies, so the project works the same on every machine.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT.
In the example Dockerfile, we don't use uv to manage the Python interpreter; instead, we call the system Python.

Comment thread docs/03_guides/08_uv.mdx
└── uv.lock
```

Make sure to commit `uv.lock` and `.python-version` to version control, so that every machine - and the Actor's Docker build - works with identical dependencies and Python version.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv doesn't install Python with UV_PYTHON_DOWNLOADS=0, so .python-version and the associated text are irrelevant.

[tool.uv]
# The Actor runs straight from the source tree as a module. uv only manages
# its dependencies, the project itself is not built and installed as a package.
package = false
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really necessary if build-system isn't defined?

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. documentation Improvements or additions to documentation. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants