Skip to content

🔧 build: cap hatchling <1.30 so pkg_meta produces publishable metadata#591

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix-pkg-meta-metadata-25
Jun 1, 2026
Merged

🔧 build: cap hatchling <1.30 so pkg_meta produces publishable metadata#591
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix-pkg-meta-metadata-25

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Jun 1, 2026

Copy link
Copy Markdown
Member

The pkg_meta CI environment started failing on every branch with:

twine check ... ERROR InvalidDistribution: Invalid distribution metadata: '2.5' is not a valid metadata version

hatchling 1.30.0 began emitting Metadata-Version: 2.5 (PEP 794, adding Import-Name/Import-Namespace), and [build-system].requires pinned only hatchling>=1.27, so fresh CI resolved to 1.30. 🔧 The problem is not just the checker: metadata 2.5 cannot actually be published today.

So a 2.5 wheel is unpublishable regardless of the checker, and pkg_meta's red is correct signal. The minimal fix that keeps the package genuinely publishable is to cap the build backend just below the version that introduced 2.5:

hatchling>=1.27,<1.30

This produces Metadata-Version 2.4, which both released twine and PyPI accept. Verified tox -e pkg_meta goes green (uv build + twine check + check-wheel-contents). ⏳ A comment in pyproject.toml marks this as removable once twine ships pypa/twine#1317 and PyPI implements pypi/warehouse#19083 — at which point the cap should drop and the twine>= floor bump instead.

Refs:

@gaborbernat gaborbernat marked this pull request as draft June 1, 2026 01:06
hatchling 1.30.0 began emitting Metadata-Version 2.5 (PEP 794) in built
wheels and sdists. The pinned twine floor (twine>=5.1.1, resolving to the
latest released twine 6.2.0) hardcodes its accepted metadata versions up
to 2.4 and rejects 2.5, so `twine check` aborts with
"'2.5' is not a valid metadata version".

No released twine accepts metadata 2.5 yet (support exists only on twine
git main, unreleased), so bumping the twine floor is not viable. Instead
cap the build backend to hatchling>=1.27,<1.30, which emits metadata 2.4
that released twine accepts. This keeps the build sound until twine ships
metadata 2.5 support, and unblocks the pkg_meta CI gate repo-wide.
@gaborbernat gaborbernat force-pushed the fix-pkg-meta-metadata-25 branch from 63597de to 1d3e56f Compare June 1, 2026 02:50
@gaborbernat gaborbernat changed the title 🔧 build: cap hatchling so pkg_meta twine check passes 🔧 build: cap hatchling <1.30 so pkg_meta produces publishable metadata Jun 1, 2026
@gaborbernat gaborbernat marked this pull request as ready for review June 1, 2026 02:56
@gaborbernat gaborbernat merged commit 25372d5 into tox-dev:main Jun 1, 2026
12 checks passed
gaborbernat added a commit that referenced this pull request Jun 1, 2026
Follow-up to #591. That PR capped `hatchling<1.30` because 1.30 emitted
Metadata-Version 2.5 (PEP 794), which no released twine and PyPI accept
yet.

hatchling 1.30.0 has since been **yanked** from PyPI, with the yank
reason: *"the default core metadata version was increased to 2.5 and
some major projects like twine do not yet support it."* pip and uv skip
yanked releases during resolution, so the build now lands on 1.29.0
(Metadata-Version 2.4) without any upper bound. ⏪ The explicit cap is
therefore redundant.

Dropping it back to `hatchling>=1.27` keeps us forward compatible: the
full chain to publishing 2.5 needs a twine release (pypa/twine#1317),
then a pypa/gh-action-pypi-publish release, then dependabot bumping the
pinned publish action — once that lands, a future unyanked hatchling can
emit 2.5 without another pyproject edit.

Verified locally: with no cap the build resolves to hatchling 1.29.0,
emits Metadata-Version 2.4, and `tox -e pkg_meta` passes (uv build +
twine check + check-wheel-contents).

Refs:
- #591 — the cap this reverts
- pypa/twine#1317 — removes the validator monkeypatch (merged,
unreleased)
- pypi/warehouse#19083 — PyPI support for Metadata 2.5 (open)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant