[Python-ideas] Draft PEP for virtualenv in the stdlib

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Oct 26 11:02:52 CEST 2011


Nick Coghlan <ncoghlan at ...> writes:

> I think explaining to people "sys.venv_prefix is still valid when
> you're not in a virtual env, it just points to the same place as
> sys.prefix" is easier than explaining a *new* name with "<whatever
> name> points to the virtual env directory when you're in a virtual
> environment and sys.prefix otherwise".

I thought Carl was saying that we use "local_prefix" as opposed to
"venv_prefix", because the "local_" prefix seems logical and doesn't override
"site". In a venv, local_prefix/local_exec_prefix point to the venv, otherwise
they have the same values as prefix/exec_prefix. The "venv_XXX" does grate a
bit, especially as we're trying to achieve a don't-know-or-care-if-
I'm-in-a-venv as much as possible.

And thinking more about overriding "site" - what is a "site" anyway? It seems
to be a combination of Python version, standard library and a specific set of
packages (comprising in the general case include files, shared libs and
extension modules) - if I installed 3 different versions of Python on my
system, I would have three different sites. By that definition, a venv is
really a site, albeit a pared-down one which references shared code and library
where possible.

So site_prefix/site_exec_prefix don't seem unreasonable to me, or failing that,
local_prefix/local_exec_prefix would be preferable to
venv_prefix/venv_exec_prefix.

Regards,

Vinay Sajip




More information about the Python-ideas mailing list