-
Notifications
You must be signed in to change notification settings - Fork 124
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
dash vs underscore in wheel and sdist metadata name #369
Comments
I should have mentioned, this was with the I also tested with
|
This is specific to the backend and not related to build. You should talk to either setuptools or flit if you find the behaviour problematic. But the behaviour is purely cosmetic and should not be problematic in any way. Technical context: The behaviour is called name normalisation. Underscore and dash (also dot) are treated as equivalent in Python projects and therefore used interchangably in a lot of places. For example, the wheel always use |
I did realise after seeing the different behaviour from |
Is this normalised |
It's also generated by the backend. I don't think setuptools would be interested in changing this though, also mainly for compatibility reasons. The packaging standard also does not require backends to perform normalisation there, so it's well within their rights to not normalise. Furthermore IIRC a setuptools maintainer (forgot who) once told me they prefer keeping unnormalised name in package metadata because that's what the user wants to name their package. I don't particularly agree with it, but again, they are allowed to do what they wish here. |
https://packaging.python.org/specifications/source-distribution-format/#source-distribution-file-name says, "The name and version components of the [sdist] filename MUST match the values stored in the metadata contained in the file", where "the file" presumably means |
Okay, PEP 643 contains this line:
... so whatever that document says goes, though I can't imagine that it should apply retroactively, so setuptools would have to embrace Core Metadata 2.2 first... |
My interpretation to "match" in the sentence is the name (and version) should match metadata after normalisation, not that they must match literally. But wording (among many other things) around sdist has always been very lax so feel free to raise this issue on Discourse for clarification and perhaps a fix to the standard. |
That would be very peculiar if true but I've started https://discuss.python.org/t/source-distribution-specification-clarification/10965. Closing this one - you can follow the Discourse thread and the setuptools issue for the issue with setuptools. |
I have a package with the name defined in setup.cfg:
I am building the package with
python3 -m build
.When I inspect the generated artifacts both wheel and sdist filenames contain
my_package-0.0.1
in the filename, however I see the wheel and sdist have different names defined in the included metadata.The wheel has in
METADATA
:The sdist has in
PKG-INFO
:When I upload these two files to my private Nexus repository, they each appear in a separate location.
The wheel ends up at
my-package/0.0.1/my_package-0.0.1-py3-none-any.whl
while the sdist ends up atmy_package/0.0.1/my_package-0.0.1.tar.gz
.If I change the
name
in setup.cfg frommy_package
tomy-package
then the wheel and sdist now have different filenames (my_package-0.0.1-py3-none-any.whl
vs.my-package-0.0.1.tar.gz
) but they do now have identical metadataName: my-package
.Are the wheel and sdist formats are supposed to generate different metadata/filenames from the same source and I should submit a bug report to Nexus?
Or they should contain identical metadata/filenames and it is a bug in
build
?Or are both
build
and Nexus operating correctly following any relevant PEPs and there's nothing to fix here?The text was updated successfully, but these errors were encountered: