Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python package wheel PKG-INFO name

I followed Packaging and Distributing Projects to create a Python package to upload to Artifactory. In my setup.py, I specified name='foo_bar' and then I ran python setup.py bdist_wheel. I noticed that in egg-info\PKG-INFO, name got changed to foo-bar. This also determines the package folder name on Artifactory upon upload. However, I like to keep it the same as what I specified in setup.py, any idea why this is happening? It seems like bdist_wheel automatically converted _ to -.

like image 440
Bob Avatar asked Mar 30 '16 05:03

Bob


Video Answer


1 Answers

According to PEP 0426 -- Metadata for Python Software Packages 2.0, both hyphen and underscore are legal characters for name. However, it also says the following:

All comparisons of distribution names... MUST consider hyphens and underscores to be equivalent.

This doesn't really answer your question as to why it is being changed, but it does at least assure you that the name should be treated as equivalent either way.

like image 111
Terrabits Avatar answered Oct 17 '22 21:10

Terrabits