-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Wheel naming is not following PEP 491 convention #3777
Comments
As much as I dislike unnecessary name mangling, this report does appear to be correct. I'm unsure if Setuptools is responsible for the naming or if the wheel package is. Regardless, it probably should be fixed. @dholth is there any chance the PEP could be updated to allow |
@jaraco I belive that the PEP originally allowed for (Although after a quick look on the Discourse thread, it looks to me that the |
The current spec seems to say that full name normalization should happen (i.e. lower case + runs of special chars to underscore), and from my quick test "newer" backends all follow that. From distribution viewpoint, we'd also prefer setuptools following, as otherwise we end up with unpredictable filenames (with some backends producing normalized names with others not). |
Apparently wheel is, with |
Hi @jaraco, there was a discussion recently on the Python discourse about the normalisation of the distribution file names https://discuss.python.org/t/change-in-pypi-upload-behavior-intentional-accidental-pebkac/27707. I will try to summarise the key takeaways I found on why most of the community seems to be in favour of the normalisation. Hopefully this answers the question "What was the motivation for mangling them?":
So it seems that the name change unlocks optimisations and simplifications. @bastienqb, if you would like you can chip in the discussion on https://discuss.python.org/t/change-in-pypi-upload-behavior-intentional-accidental-pebkac/27707 to explain why keeping the names in the format |
Unfortunately, I don't think that answers my question - "why is Moreover, if the goal is to collapse any characters that a user might find confusing, it suggests that other normalization should occur. By this logic, PyPI should probably also normalize "I" and "l", maybe "j" and "i", "3" and "e", and probably others. Since there's a strong push toward PyPI names being valid Python identifiers and since "jaraco.collections" and "jaraco_collections" are very much different Python identifiers, I feel strongly that either or both names should be allowed and should be different packages. I'm very much in support of normalizing for security and to limit the diversity of the namespace and to do that in a way that's largely transparent to the user. What I'd really like to avoid is users seeing "downloading zope_interface" when the package they're downloading is "zope.interface" and the Python package that's installed is The most important factor here is not to give namespace packages a second-class experience, and that's exactly what they'll get if they follow the convention of naming the package by mapping the Python package to the Distribution package name and the |
There's some confusion happening here. Regardless of what happens, PyPI (and everyone else) is going to treat There's some confusion that came out of some of the specs where the On PyPI we normalize the name in the Simple API URLs only. So for The question is largely around filenames. Does The specs as they're currently written decide that the filename is not a user facing value, and treats them much like the URLs in the So ultimately the question is:
Is it OK for the filenames to be:
or MUST it be:
|
@abravalheri shared your question here on the linked thread, and ended up being convinced by the chorus of responses, so I'll try to summarize the main reasons other PyPA maintainers cited:
However, there was equally strong support for only applying normalization to the identifiers that are not primarily user-facing, i.e. the artifact filenames and the Therefore, it seems a PEP formally declaring that |
I concede. It doesn't matter what the motivation was to consider |
Just to be clear, this was only the case for sdist and wheel filenames, dist-info directories and when requesting a package by name from an index—there was also strong consensus that they should not be considered equivalent in the canonical project name, the |
The current behavior of keeping dots in wheel filenames is causing problems for uv, which assumes spec-normalized filenames (astral-sh/uv#8030). |
Since setuptools violates the wheel filenames spec (pypa/setuptools#3777), we have to use the raw filename when publishing to get through https://github.com/pypi/warehouse/blob/50a58f3081e693a3772c0283050a275e350004bf/warehouse/forklift/legacy.py#L1133-L1155. Tested with ``` cargo run publish aviary.gsm8k-0.7.6-py3-none-any.whl --publish-url https://test.pypi.org/legacy/ ``` Fixes #8030
@konstin, if you would like to open a PR that would be welcome. |
Hello everyone, I'm Natalia, the current Django Fellow (this is Django's equivalent to Python's Developer in Residence). I wanted to mention that this issue is also affecting Django. Given the recent PyPI deprecation notice about PEP-625, we are now working on updating However, we are facing an issue where building the binaries results in a lowercase tarball and a capitalized wheel. This inconsistency is problematic for us, and despite we are evaluating changing the Because of the above, and because Django issues monthly releases, which sometimes include planned and prenotified security releases that we can't delay or postpone, I wanted to ask if there is any concrete information on whether this may be fixed soon-ish. We don't know exactly when PyPI will enforce the name normalization (see this comment to follow that tangent), so any extra information would certainly help us making further decisions. Thank you so much! |
@nessita, I'm sorry if that sounds off place, but have you considered switching to a different build system? FWICS Django follows PEP 621, and unless I'm missing something, it doesn't really use any setuptools features that wouldn't work with a minimal build system such as |
Thank you @mgorny, no comment is off place when it means well! That's a fair proposal, I'll talk it up with the other contributors to further evaluate 🌟 |
Hi @nessita which version of setuptools you are using? I was under the impression that the latest versions do produce consistent naming with the PEP (but I might be wrong). Update: it seems that we solved the problem in the sdist, but not in the wheel... We might have a look on the code coming from the |
I'm using the latest version (released 3 weeks ago) and the wheel is not lowercased:
|
Took a shot at fixing this bug, I think #4766 will resolve it but there's one failing test that I haven't been able to figure out. |
setuptools version
setuptools==66.0.0
Python version
python 3.8
OS
macOS
Additional environment information
No response
Description
I am building a wheel for a python package using setuptools and it seems that the naming of my wheel file is not respecting the PEP 491 convention.
For external reasons, I need to name my package with the structure
{namespace}.{package-name}
. If I follow the convention, I would expect that my wheel file is named:namespace_package_name-0.1.0-py2.py3-none-any.whl
.However, I get this name for my wheel:
namespace.package_name-0.1.0-py2.py3-none-any.whl
, which is not respecting the convention.Expected behavior
I expect the "." in the package name to be replaced with a "_" in the wheel name.
How to Reproduce
setup.cfg
, write:project.toml
, write:pipx run build
at the root of your hello_world packagedist
directory which was createdOutput
in the dist folder, you find:
namespace.my_package-0.1.0-py3-none-any.whl
The text was updated successfully, but these errors were encountered: