[Python-ideas] Add a site.cfg to keep a persistent list of paths

Nick Coghlan ncoghlan at gmail.com
Wed Oct 20 15:38:56 CEST 2010

On Wed, Oct 20, 2010 at 7:57 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 19 October 2010 22:26, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
>> There's one feature I want to add in distutils2: the develop command
>> setuptools provides. Basically it adds a "link" file into
>> site-packages, and does some magic at startup to load the path that is
>> contained in the link file. The use case is to be able to have a
>> project added in the python path without installing it.
> Can you explain the requirement in more detail? I don't use the
> setuptools develop command, so I don't have the background, but it
> seems to me that what you're proposing can be done simply by adding
> the relevant directory to PYTHONPATH. That's all I ever do when
> developing (but my needs are pretty simple, so there may well be
> subtle problems with that approach).

A different idea along these lines that I've been pondering is an
actual -p path option for the interpreter command line, that allowed a
sequence of directories to be provided that would be prepended to
PYTHONPATH (and hence included in sys.path).

So if you're wanting to test two different versions of a module (from
a parent directory containing the two versions in separate

python -p versionA run_tests.py
python -p versionB run_tests.py

For more permanent additions to sys.path, PYTHONPATH (possibly in
conjunction with virtualenv) is reasonable answer. Zipfile and
directory execution covers execution of more complex applications
containing multiple files as if they were simple scripts.

The main piece I see missing from the puzzle is the ability to easily
switch back and forth between multiple versions of a support package
or library without mucking with persistent state like the environment
variables or the filesystem.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list