Skip to content

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

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#1067
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
Contributor

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. The [tool.hatch.metadata] allow-direct-references setting is dropped, no dependency uses a direct reference.

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 uv guide's Dockerfile now pulls ghcr.io/astral-sh/uv:0.12 (in docs/ and in the version-4.0 docs snapshot; the version-3.4 snapshot is left on 0.11).

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.

✍️ 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. The `allow-direct-references`
hatch setting is dropped - no dependency uses a direct reference.
@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 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 91.89%. Comparing base (67445ba) to head (0b5afe9).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1067      +/-   ##
==========================================
+ Coverage   91.83%   91.89%   +0.06%     
==========================================
  Files          51       51              
  Lines        3232     3232              
==========================================
+ Hits         2968     2970       +2     
+ Misses        264      262       -2     
Flag Coverage Δ
e2e 35.33% <ø> (ø)
integration 57.08% <ø> (ø)
unit 83.26% <ø> (+0.06%) ⬆️

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 fd38fc1 into master Jul 29, 2026
31 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