[Python-ideas] Python Environment Initialization Scripts
Eric Snow
ericsnowcurrently at gmail.com
Sun Jul 29 05:17:47 CEST 2012
On Sat, Jul 28, 2012 at 7:54 PM, James William Pye <x at jwp.io> wrote:
>
> On Jul 28, 2012, at 5:56 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
>> No need to modify site.py. Either create a sitecustomize.py in your
>> site-packages.
>
> I had recently forgotten about that. Thanks. =)
>
> However, from the documentation:
>
> "After these path manipulations, an attempt is made to import a module named site customize,"
> "which can perform arbitrary site-specific customizations. It is typically created by a system
> "administrator in the site-packages directory."
>
> The "It is typically created by a system administrator" part is what worries me about using sitecustomize.py.
>
> In order for this to be automatic, the package containing the meta_path hook would have to install/setup sitecustomize.py upon
> `pip install metapathawesomeness` which may already be in use by the system administrator.
> That is, based on the above documentation, it doesn't seem appropriate for a package to presume that it can use sitecustomize.py in such a way.
That's where PEP 370 comes in. Stick your sitecustomize.py into
~/.local/lib/pythonX.Y/site-packages. Then it only applies when
python is run as you.
-eric
More information about the Python-ideas
mailing list