[Catalog-sig] PyPI naming policy changes

Phillip J. Eby pje at telecommunity.com
Mon May 12 17:12:50 CEST 2008


At 12:35 PM 5/12/2008 +0200, Martin v. Löwis wrote:

>- package names must differ in their pkg_resource.safe_name(p).lower()
>   values (e.g. you can't have two packages that only differ in case,
>   or in the amount of white space between words).

Hurray!  Thanks for taking care of this.


>- files must start with to_filename(safe_name(pkg_name)), ignoring case.
>   E.g. for the "BerkeleyDB Backend Storage Engine for DURUS"
>   package, valid file names would be
>   BerkeleyDB_Backend_Storage_Engine_for_DURUS-1.0.tar.gz or
>   berkeleydb_backend_storage_engine_for_durus-1.0.tar.gz, but not
>   durus-berkeleydbstorage-20061121.tar.gz.
>
>   Existing registrations are not affected; no attempt to clean
>   up the data is made.
>
>Please let me know if you see any problems with that policy.

One possible problem -- the distutils do not generate "safe" 
filenames.  That is, a project named "foo-bar" or "py-baz" will have 
'-' in the source distribution filename generated by the 
distutils.  So, if you are testing 
filename.startswith(to_filename(...)), then distutils-generated 
packages for such projects won't work.

Probably the test you want here is:

    safe_name(filename).startswith(safe_name(project_name))

As this will handle both distutils-generated and setuptools-generated 
distribution files.

(Setuptools already "knows" that distutils-generated files have this 
naming ambiguity, btw, and works around it.)



More information about the Catalog-SIG mailing list