Skip to content

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

Description

@Tranquility2

Description

The Run twine check step in the run-tests-and-coverage CI job fails on every PR build (e.g. run 31887608422 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions