← All tasks
pythontestcontainers/testcontainers-python #1096Not a task: already works

CI: twine check fails with 'Invalid distribution metadata: 2.5 is not a valid metadata version'

envgap__testcontainers__testcontainers-python-1096

01 / FAILURE SIGNATURE

As reported upstream

Checking dist/testcontainers-4.15.0-py3-none-any.whl: ERROR InvalidDistribution: Invalid distribution metadata: '2.5' is not a valid metadata version
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
53ded4d1f84916dad10ef8b82a10be4bfd6a3691
Manifest
pyproject.toml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

testcontainers/testcontainers-python #1096 · read the original issue
## Description
The `Run twine check` step in the `run-tests-and-coverage` CI job fails on every PR build (e.g. run [31887608422](https://github.com/testcontainers/testcontainers-python/actions/runs/31887608422/job/95019090461?pr=1090) on #1090):

```
Checking dist/testcontainers-4.15.0-py3-none-any.whl: ERROR InvalidDistribution: Invalid distribution metadata: '2.5' is not a valid metadata version
```

## Root cause
`hatchling>=1.32` now emits `Metadata-Version: 2.5` in built wheel/sdist metadata. The pinned `twine` (6.2.0, via `packaging`) doesn't yet recognize `2.5` as valid and rejects the distribution during `twine check`. This is unrelated to any individual PR's diff — it's caused by an unpinned build-backend version picking up a newer hatchling release. See upstream: pypa/twine#1327.

## Fix
Pinning `hatchling` to `>=1.26,<1.32` in `pyproject.toml`'s `[build-system]` keeps it emitting `Metadata-Version: 2.4`, compatible with the current twine/packaging toolchain.

Fixed in #1095.
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]