On 24/02/2021 15.16, Random832 wrote: > On Wed, Feb 24, 2021, at 06:27, Christian Heimes wrote: >> Separate directories don't prevent clashes and system breakage. But they >> provide an easy way to *recover* from a broken system. > > I think it could be turned into a way to prevent them by A) having > site-packages always take precedence over dist-packages [i believe this is > already the case] in normal usage and B) providing an option to the > interpreter, used by system scripts, to exclude site-packages entirely from > the path. > > Basically, site-packages would effectively be layered on top of "Lib + > dist-packages" in a similar way to how a venv is layered on top of the main > python installation - the inverse of the suggestion someone else in the > thread made for the system python to be a venv. This wouldn't *exactly* be a > venv because it wouldn't imply the other things that entering a venv does > such as "python" [and script names such as pip] being an alias for the > correct version of python, but it would provide the same kind of one-way > isolation, whereby the "system environment" can influence the "normal > environment" and not vice-versa, in the same way that packages installed in > the main installation affect a venv [unless system-site-packages is disabled] > but the venv obviously has no effect on the main installation.
Yes, you are describing one major aspect of my idea for a system Python interpreter. I'm happy to read that other users are coming to similar conclusions. Instead of an option I'd create a new executable to lock down additional things (e.g. isolated mode, code verification hook). A separate executable would also allow distros to provide a stripped down interpreter that does not cause bad user experience. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/F5NCGF7EWYDMBAHPNDFNWWKSE2GRKHLA/ Code of Conduct: http://python.org/psf/codeofconduct/