Message333705
| Author | jaraco |
|---|---|
| Recipients | Anthony Sottile, Chris Billington, Ivan.Pozdeev, SilentGhost, __Vano, barry, brett.cannon, christian.heimes, emma_smith, eric.smith, eric.snow, 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 | <1547560891.05.0.0500106769041.issue33944@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
> `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 https://files.pythonhosted.org/packages/36/25/070c2dc1fe1e51901df5875c495d6efbbf945a93a2ca40f47e5225302fb8/future_fstrings-0.4.5-py2.py3-none-any.whl Saved ./pkgs/future_fstrings-0.4.5-py2.py3-none-any.whl Collecting tokenize-rt; python_version < "3.6" (from future_fstrings) Using cached https://files.pythonhosted.org/packages/76/82/0e6a9dda45dd76be22d74211443e199a330ac7e428b8dbbc5d116651be03/tokenize_rt-2.1.0-py2.py3-none-any.whl Saved ./pkgs/tokenize_rt-2.1.0-py2.py3-none-any.whl Successfully downloaded future-fstrings tokenize-rt draft $ cat > hello-fstrings.py # 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 hello-fstrings.py 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 hello-fstrings.py File "hello-fstrings.py", 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-fstrings.py 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. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-01-15 14:01:33 | jaraco | set | recipients: + jaraco, mhammond, barry, brett.cannon, terry.reedy, ncoghlan, pitrou, vstinner, eric.smith, christian.heimes, SilentGhost, __Vano, eric.snow, takluyver, Ivan.Pozdeev, Anthony Sottile, emma_smith, Chris Billington |
| 2019-01-15 14:01:31 | jaraco | set | messageid: <1547560891.05.0.0500106769041.issue33944@roundup.psfhosted.org> |
| 2019-01-15 14:01:31 | jaraco | link | issue33944 messages |
| 2019-01-15 14:01:30 | jaraco | create | |