Thomas Kluyver <tho...@kluyver.me.uk> added the comment:

As a lurker on this issue: I think a lot of energy is being expended arguing 
about what is and isn't legitimate use cases, when there's actually more stuff 
that people agree about than not.

I think this issue should be broken down into two, neither of which will 
actually result in removing pth files:

1. Better ways to inspect and control the sys.path extension feature (as per 
Barry's message https://bugs.python.org/issue33944#msg337417 ).
2. Designing a replacement for the arbitrary-code-at-startup feature (or even 
several replacements to meet different needs), leading to its eventual 
deprecation.

If you like the ability for packages to install interpreter-startup hooks, then 
pth files are an ugly way to do it. If you don't, then you want better ways to 
control it. So let's see what we can come up with.

At least several important use cases (coverage and debugging) would probably 
work with an environment variable to specify startup code. The coverage hooks 
already check an environment variable themselves, so it's clearly a control 
mechanism that works. It's also familiar from things like LD_PRELOAD that 
environment variables can affect code in powerful ways.

But the PYTHONSTARTUP variable is not suitable for this, because it only 
affects interactive shell sessions. So maybe one useful step would be to 
specify a new environment variable, maybe PYTHONPRELOAD, and figure out how it 
will interact with all the other options.

Then we can re-evaluate the use cases Anthony described 
(https://bugs.python.org/issue33944#msg337406 ) and debate the need for other 
startup-code mechanisms to go along with that.

----------

_______________________________________
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