[Python-Dev] Python and the Linux Standard Base (LSB)

Phillip J. Eby pje at telecommunity.com
Thu Nov 30 05:45:06 CET 2006

At 06:49 PM 11/29/2006 -0500, Barry Warsaw wrote:
>What might be nice would be to build a little more
>infrastructure into Python to support eggs, by say adding a default
>PEP 302 style importer that knows how to search for eggs in
>'nests' (a directory containing a bunch of eggs).

If you have setuptools generate your scripts, the eggs are searched for and 
added to sys.path automatically, with no need for a separate importer.  If 
you write standalone scripts (not using "setup.py develop" or "setup.py 
install"), you can use pkg_resources.require() to find eggs and add them to 
sys.path manually.  If you want eggs available when you start Python, 
easy_install puts them on sys.path using .pth files by default.

So, I'm not clear on what use case you have in mind for this importer, or 
how you think it would work.  (Any .egg file in a sys.path directory is 
already automatically discoverable by the means described above.)

>What if then that importer were general enough, or had a subclass
>that implemented a policy for applications where <prefix>/lib/
>pythonX.X/app-packages/<application> became a nest directory.

Simply installing your scripts to the same directory as the eggs they 
require, is sufficient to ensure this.  Also, since eggs are versioned, 
nothing stops you from having one giant systemwide egg 
directory.  Setuptools-generated scripts automatically adjust their 
sys.path to include the specific eggs they need - and "need" can be 
specified to an exact version if desired (e.g. for system admin tools).

>I haven't really thought this through so maybe it's a stupid idea,
>but ISTM that would make management, installation, and use in an
>application about as simple as possible.  (Oh yeah, add an --
>uninstall switch too :).

Yeah, that's targeted for the "nest" package management tool, which I may 
have some time to work on someday, in my copious free time.  :)  In the 
meantime, 'easy_install -Nm eggname; rm -rf /path/to/the.egg' takes care of 
everything but the scripts.

More information about the Python-Dev mailing list