Explicitly requiring `.dist-info` and `.data` in wheel files use normalized name and version

It came up on Discord thanks to @henryiii that the spec don’t explicitly state the the name and version used for .dist-info and .data in a wheel file should be normalized. But as @uranusjr pointed out, it’s implied by the wheel installation spec.

I opened Clearly specify that the name and version should be normalized for `.dist-info` and `.data` directories in wheels by brettcannon · Pull Request #1789 · pypa/packaging.python.org · GitHub to makes this more clear, but since this is technically a spec change I figured we should all agree to it first.

3 Likes

I should probably add, hatchling and scikit-build-core already normalize. Setuptools does not, but there’s a pr that should fix that. And this comes up in distro packaging occasionally since pkg_resources.requires doesn’t support normalized names, and it’s deprecated so this 2022 issue likely won’t be fixed. I believe distros have been working around normalizing backends by adding a symlink with the un-normalized name. Having this clearly stated in the spec would help validate the need for the workaround (and probably help with the setuptools PR), rather than having some claim it’s a bug in non-setuptools backends. :wink:

1 Like

I am in agreement with making the intention explicit.

1 Like

I agree that this is worth clarifying, and I support requiring normalisation.

Normalisation should include replacing dash characters with underscores, the same as in the section you linked to.

2 Likes

FYI I don’t know what threshold of timeframe we want to wait to merge the PR, but I don’t have commit rights so I can’t do it regardless.

We had bugs due to the lack of normalization in (older) wheels, I’m strongly in favor of requiring normalization.

1 Like

We don’t have a minimum time written down anywhere, so it’s pretty much “Whatever the PyPUG editors deem reasonable”.

And while I do agree with the clarification, “less than 48 hours” doesn’t seem sufficient time to allow for objections, so I’ll merge it Tuesday AEST if there aren’t any objections before then.

(I was going to say Monday, but Monday AEST is still the weekend for other parts of the world)

4 Likes