[Distutils] Changing the separator from - to ~ and allow all Unicode alphanumerics in package names...

Daniel Holth dholth at gmail.com
Sat Nov 10 03:38:54 CET 2012


Although I think the ~ is a very ugly -, it could be useful to change the
separator to something less commonly used than the -.

It would be useful to be able to use the hyphen - in the version of a
package (for semver) and elsewhere. Using it as the separator could make
parsing the file name a bit trickier than is healthy.

This change would affect PEP 376 which reads:

This distinct directory is named as follows::

    name + '-' + version + '.dist-info'

python_package-1.0.0_four+seven.dist-info

with today's hyphen/underscore folding: re.sub('[^A-Za-z0-9.]+', '-',
version), could become

python-package~1.0.0-four+seven.dist-info


It would also affect pip, setuptools, and the wheel peps. If we do this, I
would like to allow Unicode package names at the same time. safe_name(),
the pkg_resources function that escapes package names for file names, would
become

re.sub(u"[^\w.]+", "_", u"package-name", flags=re.U)


In other words, the rule for package names would be that they can contain
any Unicode alphanumeric or _ or dot. Right now package names cannot
practically contain non-ASCII because the setuptools installation will fold
it all to _ and installation metadata will collide on the disk.

safe_version(), presently the same as safe_name() would also need to allow
+ for semver.


Does anyone have the energy to actually implement a proof-of-concept?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20121109/ad1e731d/attachment-0001.html>


More information about the Distutils-SIG mailing list