Message 333637 - Python tracker (original) (raw)
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 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.