[Distutils] PEP 376 - site-directories and site.addsitedir

P.J. Eby pje at telecommunity.com
Thu May 14 23:27:20 CEST 2009


At 11:10 PM 5/14/2009 +0200, Tarek Ziadé wrote:
>2009/5/14 P.J. Eby <pje at telecommunity.com>:
> > IOW, this approach keeps simple things simple, and leaves complex things
> > possible.  It also does less I/O than what you're proposing, since in the
> > normal case the directories are only ever searched once, and the actual
> > metadata reads are both lazy and cached.
>
>Makes a lot of sense yes. I think I'll just start a prototype for that
>code,  propose 376 on python-dev and see.

Notice, by the way, that this is a good example of pkg_resources' 
code only looking complex if you haven't gone through all the 
requirements and design issues yourself.  The further you go with 
this, the more likely you're going to end up with something very much 
resembling pkg_resources itself.

The bad news is that you'll be reinventing a lot of wheels.  The good 
news is, you should also be able to understand and maintain 
pkg_resources internals by the time you're done.  ;-)

The relevant classes in pkg_resources, btw, are WorkingSet, 
Distribution, and EntryPoint.  You might want to just copy them and 
strip out the parts you don't need.  (i.e. sys.path manipulation and 
requirements-resolving stuff)



More information about the Distutils-SIG mailing list