Skip to content
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

Flit can't generate a proper wheel file name for project names with dots #442

Closed
Jackenmen opened this issue Aug 28, 2021 · 4 comments
Closed

Comments

@Jackenmen
Copy link

For example:

  • pyproject.toml
[build-system]
requires = ["flit_core >=2,<4"]
build-backend = "flit_core.buildapi"

[tool.flit.metadata]
module = "simplepackage"
dist-name = "simplepackage.py"
author = "Jakub Kuczys"
classifiers = [ "License :: OSI Approved :: MIT License",]
  • simplepackage/__init__.py
"""Description..."""

__version__ = "1.0.0"

Running flit build causes this output

Writing generated setup.py                                I-flit.sdist
Built sdist: dist\simplepackage.py-1.0.0.tar.gz      I-flit_core.sdist
Copying package file(s) from C:\Users\Jakub\AppData\Local\Temp\tmpsvq3ymrp\simplepackage.py-1.0.0\simplepackage  I-flit_core.wheel
Writing metadata files                               I-flit_core.wheel
Writing the record of files                          I-flit_core.wheel
Built wheel: dist\simplepackage_py-1.0.0-py2.py3-none-any.whl  I-flit_core.wheel

and these files to be generated:

simplepackage.py-1.0.0.tar.gz
simplepackage_py-1.0.0-py2.py3-none-any.whl

While for it to work properly, it should generate these files instead:

simplepackage.py-1.0.0.tar.gz
simplepackage.py-1.0.0-py2.py3-none-any.whl
@takluyver
Copy link
Member

I think the underscore is correct. The relevant part of the wheel spec says:

In distribution names, any run of -_. characters (HYPHEN-MINUS, LOW LINE and FULL STOP) should be replaced with _ (LOW LINE). This is equivalent to PEP 503 normalisation followed by replacing - with _.

@Jackenmen
Copy link
Author

When trying to upload to PyPI, I run into this:
https://github.com/pypa/warehouse/blob/442148581c61163a2c30bca25f8ef3f06457e932/warehouse/forklift/legacy.py#L1190-L1197

As can be seen here, dots are not included in the replaced characters:
https://github.com/pypa/setuptools/blob/47b724639703d0c512f275a316dbb99e6c226e38/pkg_resources/__init__.py#L1304-L1309

Not sure whether this is because the wheel spec is wrong or because the implementation in pkg_resources is wrong but currently this prevents projects with dots in names from using wheels built by flit (though perhaps manual file rename before upload would be enough as a workaround, not sure whether this affects anything other than the file name).

@uranusjr
Copy link
Member

The underscore is correct. This should be fixed in warehouse.

@takluyver
Copy link
Member

We did have to change the wheel spec around filenames fairly recently (see pypa/pip#9628) - we found one of those cases where the spec had diverged from what important tools actually do, and adjusting the spec seemed like the most practical way forwards. But it's not a big surprise that what was written in the spec before got implemented in some places.

It looks like this has been accepted as a bug in Warehouse, so I'll close the issue here. Comments will still be available for follow up if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants