Skip to content

pip 21 rejects wheels with local version labels #9628

Open
@takluyver

Description

@takluyver

PR #9320 added some metadata validation of wheels built through pip. People using local version identifiers (e.g. 0.1+deadbeef) reported bugs in Flit because it builds wheels which pip rejects based on the filename, like this:

Building wheels for collected packages: testpkg
  Building wheel for testpkg (PEP 517) ... done
  Created wheel for testpkg: filename=testpkg-0.6.1.dev5_ga652c20-py3-none-any.whl size=1181 sha256=cb8856b9035b1cf8021533a8ce7a07f02402c942603ce53e17a5ceea7e9cd787
  Stored in directory: /home/sturm/.cache/pip/wheels/34/c8/42/38155569da3179727ba8f011d468b6a0e6f789986ec22ae3d0
  WARNING: Built wheel for testpkg is invalid: Wheel has unexpected file name: expected '0.6.1.dev5+ga652c20', got '0.6.1.dev5-ga652c20'
Failed to build testpkg

I believe Flit is complying with the spec, specifically PEP 427's section on escaping in the wheel filename:

Each component of the filename is escaped by replacing runs of non-alphanumeric characters with an underscore _:
re.sub("[^\w\d.]+", "_", distribution, re.UNICODE)

I understand that to mean that a 0.1+deadbeef version number should make a .whl filename containing -0.1_deadbeef-.Pip appears to reject that, and I believe it's pip that has this wrong. PyPUG still says that PEP 427 is the sole specification for the wheel format.

If the outcome is that the spec changes to match what pip does, that's fine, and I will fix Flit accordingly. But I don't want to assume that's the case and merge something that goes against the current spec.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions