-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Poetry builds sdist against common packaging practices #6915
Comments
It actually states exactly how the distribution name should be normalized. PEP 625 links to wheel spec for distribution name normalization and there it states:
So in my eyes, this is pretty clearly stated. PEP: https://peps.python.org/pep-0625/#specification |
I see your point, and that's fair. At a minimum this issue can stand as a reference for other users who find that |
not a bug, should be closed |
This is unfortunately just the state of the ecosystem due to past ambiguity. Poetry was broken in one way, and we have chosen instead to align with the new PEP that tries to remove this ambiguity, which may break users moderately in another way. That being said, Poetry is now well-behaved and it is only other tools with latent bugs like Poetry's previous versions that should present problems -- as they become compliant, this will solve itself. |
@neersighted do you have some links to when Poetry became compliant to this naming ambiguity (PR / issue ...)? |
Here: #6621 |
From Normalized Names in PEP-503:
If I understand correctly, a package can be named Sorry if it is not the good forum, feel comfortable redirecting me in any case. Thanks |
This is not the best forum, but hopefully the conversation is short: What is being referenced here is sdist names, which are now normalized like wheel names. Technically a registry can still host a package using a pretty name (with dots or capitalization, etc) while serving distfiles with normalized names. However, as PyPI derives the project name from the name of the first artifact uploaded, the only way to name a PyPI project with a pretty name is to upload using a renamed sdist with Twine, so that PyPI uses the pretty name of the sdist. After that point, you can use Poetry to upload and PyPI will correctly match the files to the project. But Poetry will only ever output normalized names as required by the spec, so unless you rename the files yourself you cannot manipulate PyPI this way. Other indexes that don't infer a project name from an attempt to upload a non-existent name will be less obnoxious here. There's also the fact that the naming rules still create ambiguity and PyPI misbehaves here (but won't fix it under the under-specification is solved) e.g. https://discuss.python.org/t/amending-pep-427-and-pep-625-on-package-normalization-rules/17226. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option) and have included the output below.Issue
Poetry 1.2.2 introduced this change (#6621) with the intention to normalize sdist naming conventions, which appears to put the generated
sdist
files in muddy waters regarding PEP625 and historical convention for sdist naming. The specification states:Unless I'm missing something, it does not specifically state how to handle underscores in the distribution names themselves, but convention has been to have the package name contain dashes rather than underscores for sdist, and underscores for the wheel. E.g., for the example pyproject.toml, the previous behavior (v1.2.1) was:
The introduced changes appear to violate this for packages which have an underscore/dash in them. In the latest version, it builds an sdist package with underscores rather than dashes:
While as far as I can tell this does not technically run awry of the PEP, we are seeing in practice that our internal PyPI infrastructure in place seems to reject sdist packages with an error along the lines of:
I cannot pretend to understand all of the configuration or customizations that exist in our internal PyPI infrastucture, as the exact nature of this is obfuscated from me. I also understand that it would be easy to close this problem as WONTFIX, under the idea that "this does not sound like a poetry problem". But I think the changes we are seeing were not intended to be breaking, especially as a patch fix. But this change appears to have inadvertently injected a fairly opinionated change to how sdist packages are named that breaks implied backwards compatibility, without offering much in the way of clear upside. If we have issues on our system, I imagine others who rely on this historical convention may also see issues.
This thread in pypa/build offers some good insights here: pypa/build#369. Specifically, this helps contextualize this:
I think ultimately the intent of name normalization names sense, and yes, it is probably the fault of other systems for relying on convention over explicit specification. But in this case it seems as though there is a high potential this violates assumptions that other systems hold that poetry would ideally integrate nicely with. And in doing so, it's not clear that any specific value has been added in terms of coercing dashes to underscores as the means of normalization.
In thinking about how to resolve this, my recommendation would be the following:
I'd be interested in hearing thoughts on what the intent and preferred way forward would be here.
The text was updated successfully, but these errors were encountered: