Skip to content

build: replace hatchling with the uv_build backend - #980

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

build: replace hatchling with the uv_build backend#980
vdusek merged 3 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.

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.

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

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 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 94.62%. Comparing base (b49fb35) to head (3d377de).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #980   +/-   ##
=======================================
  Coverage   94.62%   94.62%           
=======================================
  Files          58       58           
  Lines        5248     5248           
=======================================
  Hits         4966     4966           
  Misses        282      282           
Flag Coverage Δ
integration 92.26% <ø> (ø)
unit 83.89% <ø> (ø)

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 784006e into master Jul 29, 2026
30 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