[Distutils] PEP 376 for Distutils

Joachim König him at online.de
Tue Feb 24 09:39:18 CET 2009


Tarek Ziadé wrote:
> If you look at install_egg_info, it will add the Python version
>
> http://svn.python.org/projects/python/trunk/Lib/distutils/command/install_egg_info.py
>
> I am not sure either this should be kept. I don't see the rationale
> either, since
> sys.version is known at runtime, it seems superfluous.
>
> Maybe it should be deprecated.
>
> I having the same problem with the version : since it is already
> located in PKG-INFO,
> there's no need to have it in the folder name;
>
> So maybe the final version could be:
>
>     - zlib
>     - zlib.egg-info/
>         PKG-INFO
>         MANIFEST
>         RECORD
>   
And while we are at it:

could the egg-info directory be put somewhere else (as a 
configuration/command line option)?

It's meta information about the packages and not python code. And when 
doing a simple 'ls'
on the site-packages folders I woul like to see the packages only and 
not 2 entries per
package.

An other option could be to put the egg-info dir into the package 
itself, e.g.

zlib/
    __init__.py
    egg-info/
        PKG-INFO
        MANIFEST
        RECORD
   ...

P.J. Eby wrote about the encoding of package and python version inside 
the egg-info directory name:
> It's there so pkg_resources doesn't need to read the file in order to 
> locate an available version of the package, just the listdir() that it 
> was doing anyway.  In other words, it's a performance optimization, 
> and a pretty major one when you're building an Environment object to 
> look for available package versions.  Cuts down on a LOT of file opens 
> in the case where you have a ton of .egg-info's in site-packages, like 
> on a Linux system with Python 2.5.

If the location of the egg-info dir and the encoding of the python 
version and package
version are only there for performance optimization reasons I'd suggest 
to really decouple
optimization from file naming and having a caching directory that can 
compute an
optimized representation once when an out-of-date situation is detected 
(e.g. when new
packages are installed) making the optimization even faster, e.g. by 
having a file
in suitable format instead of calling os.listdir() and iterating over 
the result.







More information about the Distutils-SIG mailing list