[Distutils] PEP 376 for Distutils

Tarek Ziadé ziade.tarek at gmail.com
Tue Feb 24 13:33:41 CET 2009

Philip wrote:
> When a distutils package does it.  I'm not positive, but if 'pip' supports namespace packages without using .pth files, then it has to use a shared __init__ also.
> And in the long run, easy_install will do this too.
> So, the uninstallation code should simply not remove file(s) that are referenced by more than one manifest in the target directory -- a relatively simple, future-proof safeguard, that doesn't require any specific knowledge of "namespace packages" per se.

Sounds good. Although, it requires scanning the files again which is
not optimal, but the last point of this mail might be an idea to
adress this.

2009/2/24 Joachim König <him at online.de>:
> 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
>  ...

This would require setuptools and pip to change the way they look for
the packages,
but if the functions to work with this are located in Python, they
will be able to use the
same bits which could be great.

> 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.

Indeed. Having an index file would make things a whole lot simpler.
I am wondering then if this is not an evolution of the .pth files.

Although I find that having as many .pth file as we want is not robust.
It make things slow down when you have too many of them.

So, I'd be in favor of a new, unique, optimized, index file,
with a set of functions located in pkgutil to read and write in it

This index file could also index the namespace information,
in order to speed up the work needed to uninstall a package that
shares a namespace.


Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/

More information about the Distutils-SIG mailing list