[Distutils] setuptools: name quoting

Phillip J. Eby pje at telecommunity.com
Wed Sep 21 03:12:48 CEST 2005


At 02:59 PM 9/20/2005 -0500, Ian Bicking wrote:
>I'm a bit confused about name quoting.  I have a package with a name
>"Todo_SQLObject_ZPT", and egg_info writes to
>"Todo-SQLObject-ZPT.egg-info".  Why?  I thought -'s were bad, but _'s
>were okay...?

It's safe to use either, but setuptools considers '-' to be canonical; this 
was a heuristic decision on my part because '-' appears more frequently 
used than '_' in the names of projects currently registered with PyPI.

The problem, however, is that PyPI wants your uploaded files to *exactly* 
match the registered name.  If you used '-' in setup.py, you must have '-' 
in the filename, and that's something setuptools cannot do.  It would 
probably be best if setuptools ensured the "register" command always used 
'_', but then this defeats the purpose of having it that way in the first 
place!

So, the only real fix is to change PyPI to accept files whose 
pkg_resources.safe_name() match the safe_name() of the project.  In the 
meantime, you can't upload eggs to PyPI for packages with '-' or '_' in 
their names.  (You can upload source distros or other formats, since those 
can work with ambiguous filenames.) I probably should put in an RFE or 
proposed patch, but I've been *really* busy lately.



More information about the Distutils-SIG mailing list