[Distutils] early preview of pythonv

Carl Meyer carl at oddbird.net
Wed Mar 16 09:31:01 CET 2011


Hello all,

Here at PyCon we've had some discussion about building a
virtualenv-alike into Python core for Python 3.3. The goal is to improve
on virtualenv by providing something that does what virtualenv does
without requiring a copied Python binary, symlinked/copied parts of the
standard library, or a forked site.py.

(I'm not entirely sure that distutils-sig is the right venue for
discussing this, but it's the closest I know of and was recommended by
others in our conversations here; if there's a better place please let
me know; maybe python-ideas? The patch as is stands does affect
sysconfig.py, which is used more by distutils than anything else.)

The idea we discussed is to add to Python's built-in site.py the ability
to set paths up for a virtual environment, triggered by certain
environment variables. Then, for convenience, there'll be a small
executable which can be placed in the "bin/" directory of a virtual
environment and knows how to set up these environment variables and then
exec() the system Python binary.

Larry Hastings had already created this wrapper executable at last
year's PyCon, and tonight I made the necessary modifications to site.py
and sysconfig.py to support it on the Python side. The early prototype
is now working well (at least on Linux; I think it ought to work on OS
X, and should work partially on Windows as well), and I'd welcome review
and comment: https://bitbucket.org/carljm/cpythonv  Look in
Tools/pythonv/README.rst for instructions.

This is an early prototype and will certainly require refinement (not to
mention most likely a PEP, at some point). Please try it out and let me
know if it works for you!

Thanks,

Carl


More information about the Distutils-SIG mailing list