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

Jim Jewett jimjjewett at gmail.com
Wed Oct 26 18:04:02 CEST 2011


On Tue, Oct 25, 2011 at 9:15 PM, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> Nick Coghlan <ncoghlan at ...> writes:

>> I'd actually prefer that we use the explicit "sys.prefix" and
>> "sys.venv_prefix" naming (with the latter set to None when not in a
>> virtual env) and possibly offer a convenience API somewhere that hides
>> the "sys.prefix if sys.venv_prefix is None else sys.venv_prefix"
>> dance.

> But why is that better than a site.venv_prefix which points to a venv if you're
> in one, and == sys.prefix if you're not?

Is there a reason we can't just make sys.* be the virtual
environment's version, and sys.base.* be the site-wide version?  You
could still find sys.base.*, and you could still check whether
sys.prefix == sys.base.prefix, but programs that don't get updated
will use the sandboxed virtual version by default.

-jJ



More information about the Python-ideas mailing list