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

Installed package name should use dash not underscore #138

Open
quassy opened this issue Apr 17, 2024 · 4 comments
Open

Installed package name should use dash not underscore #138

quassy opened this issue Apr 17, 2024 · 4 comments

Comments

@quassy
Copy link

quassy commented Apr 17, 2024

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 is email_validator.

I think just the name in setup.cfg has to be changed to email-validator. (The import would of course still be email_validator.)

@quassy quassy changed the title Installed package should use dash not underscore Installed package name should use dash not underscore Apr 18, 2024
@JoshData
Copy link
Owner

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.

@quassy
Copy link
Author

quassy commented Apr 25, 2024

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.

@JoshData
Copy link
Owner

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.

@jirikuncar
Copy link

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.

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