Closed lelit closed 2 years ago
I think sdist just has no opinion on this, while wheel will convert the hyphens to underscores, because hyphens are used to separate parts in the filename. I just borrow this part from setuptools and they should have the same behavior. See Flask-SQLAlchemy for example, note the name normalization.
AFAIK, different build backends treat this differently. hatchling
lowercases the distribution name and replaces .
to _
as well, but setuptools
and pdm-pep517
keep the dots. But due to PEP 503, the index server will normalize the name when storing packages so they are the same. I think flit
complains from the client side.
Some useful links
Thank you. It's just a matter of handling the difference in my twine
-based upload rule.
Sorry to bother you, but I'm getting crazy trying to understand modern packaging rules, and here I'm asking an opinion/confirmation.
I'm trying to modernize this aspect of several projects of mine, replacing
setup.py
withpyproject.toml
, and I had different issues with every build system I tried, maybe due to the peculiar name scheme I followed for them, or instead because the specifications are imprecise and everyone interprets them in different ways.I found your project the less problematic as of now (read, I did not have any issue), and I'm taking the opportunity to say "thank you!".
Today I converted another project, whose distribution name is
metapensiero.sphinx.autodoc_sa
: everything went smooth, except that I noticed a difference in the name of the generated file for sdist and wheel:The latest version, 2.2.dev0, is the one converted to use
pdm-pep517
: as you can see, the sdist containsautodoc-sa
(with an hypen) while the wheel hasautodoc_sa
(with underscore). Previous versions were generated bysetuptools
(that is, bypython setup.py sdist
).I tried uploading those new archives to test.pypi.org and they were accepted: at first I expected a rejection due to different name, as it happened for one other project when I used
flit
as build system, but I was wrong :-)To satisfy my curiosity, I tried to find references to the file name conventions, and I found this section on PyPA:
That makes me wonder: it seems rather contradictory that it first suggests to replace runs of invalid characters with a single hyphen, but then says to replace that hyphen with an underscore.
So the question is: should I relax and accept the apparent confusion, or is there an issue in the way
pdm-pep517
generates the sdist (using metadata.project_name) vs the wheel (that instead uses metadata.project_filename)?Thanks again!