
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...? I'm also getting a traceback when I try to do "python setup develop", following. The application that is causing this problem is at http://svn.pythonpaste.org/Paste/apps/Todo_SQLObject_ZPT/trunk (it's probably broken in other ways, I'm still in the process of converting it). I'm using the latest CVS version of setuptools. Todo_SQLObject_ZPT$ python setup.py egg_info develop running egg_info writing ./Todo-SQLObject-ZPT.egg-info/PKG-INFO writing top-level names to ./Todo-SQLObject-ZPT.egg-info/top_level.txt running develop Traceback (most recent call last): File "setup.py", line 18, in ? package_data={ File "/usr/local/lib/python2.4/distutils/core.py", line 149, in setup dist.run_commands() File "/usr/local/lib/python2.4/distutils/dist.py", line 946, in run_commands self.run_command(cmd) File "/usr/local/lib/python2.4/distutils/dist.py", line 965, in run_command cmd_obj.ensure_finalized() File "/usr/local/lib/python2.4/distutils/cmd.py", line 117, in ensure_finalized self.finalize_options() File "/usr/home/ianb/co/setuptools/setuptools/command/develop.py", line 45, in finalize_options easy_install.finalize_options(self) File "/usr/home/ianb/co/setuptools/setuptools/command/easy_install.py", line 181, in finalize_options self.package_index = self.create_index( File "/usr/home/ianb/co/setuptools/setuptools/package_index.py", line 128, in __init__ Environment.__init__(self,*args,**kw) File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 558, in __init__ self.scan(search_path) File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 588, in scan self.add(dist) File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 610, in add if dist not in dists: File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1760, in __cmp__ def __cmp__(self, other): return cmp(self.hashcmp, other) File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1760, in __cmp__ def __cmp__(self, other): return cmp(self.hashcmp, other) File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1755, in <lambda> lambda self: ( File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1782, in parsed_version self._parsed_version = pv = parse_version(self.version) File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1797, in version raise ValueError( ValueError: ("Missing 'Version:' header and/or PKG-INFO file", Todo-SQLObject-ZPT [unknown version] (/usr/home/ianb/co/Todo_SQLObject_ZPT))

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.

Phillip J. Eby wrote:
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.
Richard, would you be able to make this change? It seems pretty reasonable to accept files that closely match project names.

At 08:19 PM 9/20/2005 -0500, Ian Bicking wrote:
Phillip J. Eby wrote:
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.
Richard, would you be able to make this change? It seems pretty reasonable to accept files that closely match project names.
FYI, here are the safe_name/safe_version source: def safe_name(name): """Convert an arbitrary string to a standard distribution name Any runs of non-alphanumeric characters are replaced with a single '-'. """ return re.sub('[^A-Za-z0-9]+', '-', name) def safe_version(version): """Convert an arbitrary string to a standard version string Spaces become dots, and all other non-alphanumeric characters become dashes, with runs of multiple dashes condensed to a single dash. """ version = version.replace(' ','.') return re.sub('[^A-Za-z0-9.]+', '-', version) To make an egg filename, these strings are taken and the '-' converted to a '_' so that it isn't confused with the '-' that goes between parts of the name. So given the metadata: setup( name="To-Do List", version="1.23 alpha!", ... ) The egg filename will be "To_Do_List-1.23.alpha_-py2.4-win32.egg" if generated by Python 2.4 on Windows (and it contains C extensions). Currently, if I understand it correctly, PyPI will reject this name if the name and version used for registration were "To-Do List" and "1.23 alpha!".

On Wed, 21 Sep 2005 11:19 am, Ian Bicking wrote:
Richard, would you be able to make this change? It seems pretty reasonable to accept files that closely match project names.
Yes, as long as there's no chance of conflicts between project names due to the rewriting, which I figure is pretty remote given we're not touching alphanums. As for when I would actually be able to make this change. Well, I'll look into it as soon as I can, but at the moment my plate is pretty full :( Richard
participants (3)
-
Ian Bicking
-
Phillip J. Eby
-
Richard Jones