This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mariocj89
Recipients jaraco, mariocj89, ncoghlan
Date 2020-12-16.09:42:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608111763.27.0.89032945983.issue42654@roundup.psfhosted.org>
In-reply-to
Content
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!
History
Date User Action Args
2020-12-16 09:42:43mariocj89setrecipients: + mariocj89, jaraco, ncoghlan
2020-12-16 09:42:43mariocj89setmessageid: <1608111763.27.0.89032945983.issue42654@roundup.psfhosted.org>
2020-12-16 09:42:43mariocj89linkissue42654 messages
2020-12-16 09:42:43mariocj89create