[Distutils] Script-specific .pth files?

Jim Fulton jim at zope.com
Sat Feb 11 22:19:02 CET 2006

Here's a nutty idea I thought of when thinking about some of the
recent back and forth.

I realized, when thinking about "plugins" versus "scripts" is
that a key use case is getting a script installed so that it will
run. A script comes from an egg, which depends on other eggs, and
so on.  (Of course, this gets more exciting for complex script,
like, say, Zope. :)

It occurs to me that, when a script is installed, easy_install
could generate a .pth file that named exactly those eggs the script
needed. A wrapper script could be generated that used this .pth file.
There wouldn't be any need for run-time analysis.  The script wouldn't
need to manipulate PYTHONPATH to find the needed eggs, as all of the
needed eggs would be captured in the script-specific .pth file.
Rather than determining the working set at run time, the working set
would be determined at install time.

I see a number of advantages to this approach:

- No complicated run-time path gymnastics

- Faster start-up, as there is no run-time searching for eggs
   or analysis of which eggs to use

- More determinstic behavior.  An installed script will always
   use the same eggs.  The human who installed the script can inspect
   the .pth file to see exactly what's being used.  They can even modify
   it if the feel so bold.


Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org

More information about the Distutils-SIG mailing list