3 ms·
I've got a fun issue right now – two packages with dashes in the package names but underscores in the module names: https://pypi.org/project/xml-from-seq/ http
by nicwolff 2y ago
I've got a fun issue right now – two packages with dashes in the package names but underscores in the module names:
https://pypi.org/project/xml-from-seq/ https://pypi.org/project/xml-from-seq/ → xml_from_seq
https://pypi.org/project/cast-from-env/ https://pypi.org/project/cast-from-env/ → cast_from_env
Simple normalization, right? But `pip` installs one with underscores and one with dashes:
>>> from importlib.metadata import metadata
>>> metadata('xml_from_seq')['Name']
'xml_from_seq'
>>> metadata('cast_from_env')['Name']
'cast-from-env'
so that's what ends up in `pip freeze`.
I _think_ it's because there a bdist in PyPI for one, and not the other, so `pip` is using different "backends" that normalize the names into `METADATA` differently... ugh.
- woodruffw 2y ago> I _think_ it's because there a bdist in PyPI for one, and not the other, so `pip` is using different "backends" that normalize the names into `METADATA` differently... ugh. That isn't why: it's because `cast-from-env`'s sdist is from March 2023, while PEP 625 (which strongly stipulates package name normalization) was adopted in setuptools a year later[1]. But to take a step back: why does the difference in `pip freeze` affect you? It shouldn't matter to `pip`, since PyPI will happily serve from both the normalized and unnormalized names. [1]: https://github.com/pypa/setuptools/issues/3593 https://github.com/pypa/setuptools/issues/3593