Closed quassy closed 4 months ago
PEP 503 is not relevant to packaging. It links to PEP 426 whose status is Withdrawn.
I'm not a packaging expert so I have to go by what I read, but these links don't back up your point.
You are right, 503 only mentions the “project name”. But I guess that project name is used for the package name and 503 is also mentioned by the packaging guide. Not sure how “official” that is.
Generally it seems that PyPI and tools like PIP handle dash/underscore as the same character and seem to prefer dash (PyPI redirects email_validator to email-validator).
The reason I stumbled upon this is that PyCharm will not detect a requirement email-validator
as being installed because it's installed as email_validator
, but maybe there is another underlying reason for this / it's a PyCharm issue then.
Since pip can figure it out, I think it's a PyCharm issue. Maybe I should change it to be consistent, but I want to be careful not to break things for existing users until a major version change.
It is more of a general consistency issue. I noticed a change in our lock file when updating FastAPI. Until recently, the resolved name was the normalized email-validator
, which has changed to email_validator
. Since PyPI is redirecting to the dash version, I would suggest changing the package name in metadata to the normalized version. I would not blame only PyCharm, but there can be other tools that might not be able to handle the non-normalized package name in metadata.
According to PEP 503 package names should only use ASCII alphanumeric and
-
(dash), all other characters should be replaced with-
(dash).After installing email-validator (correct name in PyPI), the name for the installed package given by
pip list
isemail_validator
.~I think just the name in setup.cfg has to be changed to
email-validator
.~ (The import would of course still beemail_validator
.)