Skip to content

build: replace hatchling with the uv_build backend and bump uv to 0.12 - #2098

Merged
vdusek merged 4 commits into
masterfrom
chore/uv-0.12-and-uv-build-backend
Jul 29, 2026
Merged

build: replace hatchling with the uv_build backend and bump uv to 0.12#2098
vdusek merged 4 commits into
masterfrom
chore/uv-0.12-and-uv-build-backend

Conversation

@vdusek

@vdusek vdusek commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Switches the build backend from hatchling to uv_build, replacing the [tool.hatch.build.targets.*] config with [tool.uv.build-backend]. Only CHANGELOG.md and CONTRIBUTING.md need an explicit source-include - the module, pyproject.toml, README, and LICENSE are in the sdist by default.

License metadata moves to PEP 639: license = "Apache-2.0" plus license-files = ["LICENSE"]. That part is required, not cosmetic: uv_build ships LICENSE inside the wheel only when it is declared via license-files, and uv rejects license-files combined with the legacy license = { file = ... } table.

The License :: OSI Approved :: Apache Software License classifier is dropped because PEP 639 deprecates license classifiers in favor of License-Expression, which now carries the same information ("Using license classifier in the Classifier Core Metadata field is deprecated and replaced by the more precise License-Expression field"). See also the core metadata spec. uv warns about the classifier on every build.

The project template's Dockerfile now pulls ghcr.io/astral-sh/uv:0.12.

Verified by building sdist + wheel before and after: the wheel contents are identical, including the cookiecutter project template, the Redis Lua scripts, and the py.typed markers. The sdist drops .gitignore and gains pyproject.toml.orig (uv 0.12 writes a TOML 1.0-compatible pyproject.toml into the sdist and keeps the original alongside it). uv.lock is unchanged.

One metadata difference worth noting: hatchling flattened the self-referential extras, so crawlee[all] was published as the full list of concrete requirements. uv_build keeps them as declared, e.g. crawlee[adaptive-crawler,...] ; extra == 'all'. Both resolve identically in pip and uv.

✍️ Drafted by Claude Code

vdusek added 2 commits July 28, 2026 22:25
Also migrates the license metadata to PEP 639 (`license` as an SPDX expression plus
`license-files`), which is what uv_build reads to ship LICENSE inside the wheel. The
resulting wheel is content-identical to the hatchling one.
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Jul 29, 2026
@vdusek vdusek self-assigned this Jul 29, 2026
@github-actions github-actions Bot added this to the 146th sprint - Tooling team milestone Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.48%. Comparing base (cd1e1f6) to head (05ce349).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2098      +/-   ##
==========================================
- Coverage   93.51%   93.48%   -0.04%     
==========================================
  Files         181      181              
  Lines       12572    12604      +32     
==========================================
+ Hits        11757    11783      +26     
- Misses        815      821       +6     
Flag Coverage Δ
unit 93.48% <ø> (-0.04%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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 ready for review July 29, 2026 06:50
@vdusek
vdusek requested a review from janbuchar July 29, 2026 06:50
vdusek added a commit to apify/apify-shared-python that referenced this pull request Jul 29, 2026
Switches the build backend from `hatchling` to `uv_build`, replacing
`[tool.hatch.build.targets.sdist]` with `[tool.uv.build-backend]`. Only
`CHANGELOG.md` and `CONTRIBUTING.md` need an explicit `source-include` -
the module, `pyproject.toml`, README, and LICENSE are in the sdist by
default.

License metadata moves to PEP 639: `license = "Apache-2.0"` plus
`license-files = ["LICENSE"]`. That part is required, not cosmetic:
`uv_build` ships `LICENSE` inside the wheel only when it is declared via
`license-files`, and uv rejects `license-files` combined with the legacy
`license = { file = ... }` table.

The `License :: OSI Approved :: Apache Software License` classifier is
dropped because [PEP 639 deprecates license
classifiers](https://peps.python.org/pep-0639/#deprecate-license-classifiers)
in favor of `License-Expression`, which now carries the same information
("Using license classifier in the `Classifier` Core Metadata field is
deprecated and replaced by the more precise `License-Expression`
field"). See also the [core metadata
spec](https://packaging.python.org/en/latest/specifications/core-metadata/#license-expression).
uv warns about the classifier on every build.

Verified by building sdist + wheel before and after: the wheel contents
are identical, and the metadata differs only in `License-Expression:
Apache-2.0` replacing the inlined license text. The sdist drops
`.gitignore` and gains `pyproject.toml.orig` (uv 0.12 writes a TOML
1.0-compatible `pyproject.toml` into the sdist and keeps the original
alongside it). `uv.lock` is unchanged.

Part of the same sweep as apify/crawlee-python#2098,
apify/apify-sdk-python#1067, and apify/apify-client-python#980.

*✍️ Drafted by Claude Code*
@vdusek
vdusek merged commit 3e9fd11 into master Jul 29, 2026
127 checks passed
@vdusek
vdusek deleted the chore/uv-0.12-and-uv-build-backend branch July 29, 2026 17:04
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants