Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

pkg_resources.safe_name() is not PEP 503 complient #13

Closed
StephanErb opened this issue Mar 31, 2018 · 5 comments
Closed

pkg_resources.safe_name() is not PEP 503 complient #13

StephanErb opened this issue Mar 31, 2018 · 5 comments

Comments

@StephanErb
Copy link

StephanErb commented Mar 31, 2018

PEP 503 states that:

[T]he only valid characters in a name are the ASCII alphabet, ASCII numbers, ., -, and _.
The name should be lowercased with all runs of the characters ., -, or _ replaced with a
single - character.

This is implemented differently in pkg_resources.safe_name(). The . (dot) should be replaced by - (hyphen) but isn't. This is causing unexpected behaviour in projects such as pip (e.g. pypa/pip#5021)

There is a little room for interpretation here, as PEP 426 does not require . to be replaced by -. However packaging.utils.canonicalize_name implements this by replacing . with - as well.

I therefore believe pkg_resources should to do the same.

@benoit-pierre
Copy link
Member

Until pkg_resources if effectively split from setuptools, the right place to fill a bug about it is still there.

@StephanErb
Copy link
Author

Ah, this explains why it is so quiet over here. Thanks :)

@StephanErb
Copy link
Author

Before anybody wonders: I just decided not to file the issue over at setuptools. PEP 503 is aimed for PyPI and friends. Changing the behaviour in setuptools would break too many things.

@pradyunsg
Copy link
Member

@StephanErb pypa/warehouse then?

@pradyunsg
Copy link
Member

Nvm me.

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

No branches or pull requests

3 participants