Antony Lee <anntzer....@gmail.com> added the comment:

There are a number of packages that can "self-import" into any Python process 
depending on the presence of an environment variable, by installing a pth file 
that contains something like `import os; __import__("thepkg") if 
os.environ.get("THEENVVAR") else None`.  Examples include colorization of 
logging output 
(https://coloredlogs.readthedocs.io/en/latest/api.html#environment-variables) 
or installation of a trace function 
(https://pypi.org/project/hunter/#environment-variable-activation).

If the pth mechanism goes away, a preload system should definitely be present 
to provide a replacement; it should again support multiple packages each 
installing their own hook.

----------
nosy: +Antony.Lee

_______________________________________
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