This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaraco
Recipients Anthony Sottile, Chris Billington, Ivan.Pozdeev, SilentGhost, __Vano, barry, brett.cannon, christian.heimes, eric.smith, eric.snow, ethan smith, jaraco, mhammond, ncoghlan, pitrou, takluyver, terry.reedy, vstinner
Date 2019-01-15.14:01:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> `site.addsitedir` is called for every site-packages directory (whether global, within a venv, or at the user level), so my proposal above covers appending multiple segments.

Good point. I think you're assuming that only site dirs are appropriate for packages that require arbitrary code execution. I think I'd like to break that assumption and allow any location where packages can be installed (PYTHONPATH) to install hooks. Consider this use-case:

draft $ mkdir pkgs                                                                                                                           draft $ python3.5 -m pip download -d pkgs future_fstrings                                                                              Collecting future_fstrings
  Using cached
  Saved ./pkgs/future_fstrings-0.4.5-py2.py3-none-any.whl
Collecting tokenize-rt; python_version < "3.6" (from future_fstrings)
  Using cached
  Saved ./pkgs/tokenize_rt-2.1.0-py2.py3-none-any.whl
Successfully downloaded future-fstrings tokenize-rt
draft $ cat >                                                                                                             # coding: future_fstrings
print(f'hello world')                                             
draft $ PYTHONPATH=pkgs/future_fstrings-0.4.5-py2.py3-none-any.whl:pkgs/tokenize_rt-2.1.0-py2.py3-none-any.whl python3.5                                               
xonsh: subprocess mode: command not found: PYTHONPATH=pkgs/future_fstrings-0.4.5-py2.py3-none-any.whl:pkgs/tokenize_rt-2.1.0-py2.py3-none-any.whl
draft $ env PYTHONPATH=pkgs/future_fstrings-0.4.5-py2.py3-none-any.whl:pkgs/tokenize_rt-2.1.0-py2.py3-none-any.whl python3.5                                           
  File "", line 1
SyntaxError: encoding problem: future_fstrings

If future-fstrings were properly installed, its runtime hook is called and the script can run:

draft $ python3.5 -m pip-run -q future-fstrings --                                                                                                                     
hello world

I'd like for a package like future-fstrings to be able to supply a hook that can be executed on startup that can be honored even if the package isn't installed in one of the site paths.

> Let's make a PEP.

I'd be delighted to help with the PEP.
Date User Action Args
2019-01-15 14:01:33jaracosetrecipients: + jaraco, mhammond, barry, brett.cannon, terry.reedy, ncoghlan, pitrou, vstinner, eric.smith, christian.heimes, SilentGhost, __Vano, eric.snow, takluyver, Ivan.Pozdeev, Anthony Sottile, ethan smith, Chris Billington
2019-01-15 14:01:31jaracosetmessageid: <>
2019-01-15 14:01:31jaracolinkissue33944 messages
2019-01-15 14:01:30jaracocreate