[Python-Dev] site enhancements (request for review)

Guido van Rossum gvanrossum at gmail.com
Tue Apr 26 11:36:05 CEST 2005


> While we're on the subject of .pth files, what about
> the idea of scanning the directory containing the main
> .py file for .pth files? This would make it easier to
> have collections of Python programs sharing a common
> set of modules, without having to either install them
> system-wide or write hairy sys.path-manipulating code
> or use platform-dependent symlink or PATH hacks.

I do that all the time without .pth files -- I just put all the common
modules in a package and place the package in the directory containing
the "main" .py files.

I do have use cases where for reasons of separate development cycles
(etc.) I have some code (usually experimental or "unofficial" in some
way)  in a different place that also needs access to the same set of
common modules, and there I use explicit sys.path manipulations. I
think that even if the proposed feature was available I wouldn't
switch to it -- it's too easy to forget about the .pth file and be
confused when it points to the wrong place. That's also the reason why
I don't use symlinks or $PYTHONPATH for this purpose. EIBTI. :-)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list