New submission from Mario Corchero <marioc...@gmail.com>:
Following the conversations in https://bugs.python.org/issue33944, wanted to discuss the support for a __sitecustomize__ folder that will hold python scripts to be executed at startup. Similar to `sitecustomize.py` but allowing different stakeholders of a Python installation to add themselves. This is basically a "supported way" of the current abuse of pth files to add startup code. How will this be useful? - Support administrators to add multiple "sitecustomize.py" files. As an example, today we are basically appending to sitecustomize when we need some additional behaviour. - Support for library owners that need some startup customization like betterexceptions. - Tools that include an interpreter like virtualenv or things like PyOxidizer by allowing them to customize the interpreter they expose to users. It basically offers a better alternative to the currently abused feature of code execution in pth. I this is something that is wanted in CPython, from the thread in https://bugs.python.org/issue33944 I see some open questions though: - Look for `__sitecustomize__` only in site paths or in PYTHONPATH? I'm honestly fine either way, but sightly incline more to @jaraco proposal to make this basically be a namespace package walking all its instances. - Should we have a custom way to disable this? Or are we happy with just `-S`. I think the `-S` is fine, it offers a similar behaviour to sitecustomize. If you want to see "how it feels", see https://github.com/mariocj89/cpython/tree/pu/__sitecustomize__ (It's not finished). If it seems interesting I would love to put a PR through. With this, we might be able to eventually remove code execution in pth files! ---------- components: Library (Lib) messages: 383129 nosy: jaraco, mariocj89, ncoghlan priority: normal severity: normal status: open title: Add folder for python customizations: __sitecustomize__ versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42654> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com