[issue33944] Deprecate and remove pth files

Jason R. Coombs report at bugs.python.org
Mon Jan 14 14:20:04 EST 2019


Jason R. Coombs <jaraco at jaraco.com> added the comment:

I like Nick's proposal. It has I believe the features that satisfy the use-cases of which I'm currently aware... with one edge case you may not have considered - support for multiple `__sitecustomize__` locations.

Consider, for example, the case where `__sitecustomize__` is in some system space unwritable by the user, but the package being installed is being installed in `--user` space.

Or consider the case where permissions aren't at play, but where you have a package installed in a different part of the PYTHONPATH. For example, [pip-run installs a sitecustomize module](https://github.com/jaraco/pip-run/blob/6203b1aa8cb52b5c181457054cf6ddaa40361437/pip_run/launch.py#L33-L44) in a temporary directory that it adds to sys.path. Ignoring for a moment the reason why it does this, I'd like to focus on the general need - that multiple paths on PYTHONPATH might expect `__sitecustomize__` support. You wouldn't want to have all of the `__sitecustomize__` hooks in one directory, because then they'll be decoupled from components that may or may not be in PYTHONPATH.

For these reasons, I think you'd want for `__sitecustomize__` to be supported to exist in multiple locations on PYTHONPATH and honor all of the files in all such directories, somewhat similar to how namespace packages are supported.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33944>
_______________________________________


More information about the Python-bugs-list mailing list