Chris Billington <chrisjbilling...@gmail.com> added the comment:

I develop analysis software for physics research, in which the user analyses 
their data using Python that they write themselves (my application functions as 
a kind of scheduler for when the analysis scripts should run and with what 
input). This software has a concept of 'the user's modules', which the user can 
import from anywhere. When the application is installed, it installs a .pth 
file to add this 'userlib' folder to the Python path. This way the user can 
maintain importable modules that they re-use in their analysis without having 
to put them on PyPI or anything like that (which would be impractical since 
they are often being hacked on and don't have anything resembling a release 
cycle). It is important that these modules aren't just available from within 
the environment my application provides, as that is a bit too rigid - the user 
should be able to use the normal Python REPL or IPython or whatever to develop 
and test their code when the 'scheduler' is not in control of running
  it. 

I'm not sure what I would do instead if .pth files went away. Modifying 
PYTHONPATH is messy since it applies to all python versions, whereas .pth files 
are nicely specific only to the one Python installation. sitecustomize.py is 
messy because if it already exists I need to programmatically modify it to add 
or remove my changes (and contend with the fact that other packages may be 
doing the same), whereas a .pth file is nicely separate.

I didn't even know about the arbitrary code execution capabilities of .pth 
files and don't really care, but keeping the ability to add directories to the 
Python path would be nice, as the alternatives for doing this are unappealing 
(and for my application, putting the code the user is hacking on daily deep 
inside a Conda environment folder hierarchy is unappealing too).

----------
nosy: +Chris Billington

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33944>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to