[Python-Dev] draft PEP: virtual environments (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Wed Nov 9 01:43:04 CET 2011
- Previous message: [Python-Dev] Emit a BytesWarning on bytes filenames on Windows
- Next message: [Python-Dev] draft PEP: virtual environments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Oct 29, 2011 at 4:37 AM, Carl Meyer <carl at oddbird.net> wrote:
Why not modify sys.prefix? - -------------------------- As discussed above under
Backwards Compatibility
, this PEP proposes to addsys.siteprefix
as "the prefix relative to which site-package directories are found". This maintains compatibility with the documented meaning ofsys.prefix
(as the location relative to which the standard library can be found), but means that code assuming that site-packages directories are found relative tosys.prefix
will not respect the virtual environment correctly. Since it is unable to modifydistutils
/sysconfig
,virtualenv
is forced to instead re-pointsys.prefix
at the virtual environment. An argument could be made that this PEP should follow virtualenv's lead here (and introduce something likesys.baseprefix
to point to the standard library and header files), since virtualenv already does this and it doesn't appear to have caused major problems with existing code. Another argument in favor of this is that it would be preferable to err on the side of greater, rather than lesser, isolation. Changingsys.prefix
to point to the virtual environment and introducing a newsys.baseprefix
attribute would err on the side of greater isolation in the face of existing code's use ofsys.prefix
.
I'm actually finding I quite like the virtualenv scheme of having "sys.prefix" refer to the virtual environment and "sys.real_prefix" refer to the interpeter's default environment. If pyvenv used the same naming scheme, then a lot of code designed to work with virtualenv would probably "just work" with pyvenv as well.
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message: [Python-Dev] Emit a BytesWarning on bytes filenames on Windows
- Next message: [Python-Dev] draft PEP: virtual environments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]