[Python-Dev] EuroPython Language Summit report

Vinay Sajip vinay_sajip at yahoo.co.uk
Fri Jun 24 15:08:09 CEST 2011

Mark Dickinson <dickinsm <at> gmail.com> writes:

> virtualenv in Python 3.3?
> -------------------------
> Apparently there was some discussion at the last PyCon about the possibility
> of virtualenv going into Python 3.3.  As far as I know there's currently no
> open tracker item or PEP for this.  Larry Hastings knows more here.
>  Update from Larry: """I'm supportive of putting it in in 3.3, and I'm
>  sitting with Raymond Hettinger right now and he supports it too.  So I
>  think if we get a working implementation it'll go in.  It's under heavy
>  discussion in c.l.p-d so I gather it's moving forward.  Last I knew it was
>  Carl Meyer pushing it forward, but Vinay Sajip is the current standard-
>  bearer.  I understand Windows support will be a bit tricky; I don't know if
>  they have someone who's going to handle it for them."""

Mark, thanks for the summary.

Re. a PEP for virtual environments in Python, Carl is working on the PEP. The
first draft by Carl with my initial comments is at [1].  There's still some
work to do before we can actually present it as a PEP we're happy with.

I'm pleased to report good progress with the proof of concept implementation.
There are some issues still with packaging which I'm working through with Éric
Araujo, but I've gone ahead and committed changes on my branch to get things
working. It's a good exercising of the packaging functionality :-)

What I have at the moment is pythonv [2]:

A modified Python which supports virtual environments via changes in
Modules/getpath.c, PC/getpathp.c, Lib/site.py, Lib/sysconfig.py,
Lib/sysconfig.cfg and Lib/distutils/sysconfig.py.

These changes basically detect if you're running in a virtual environment by
looking for an env.cfg, and if found, fixing it up so sys.path is set as it
should be. In addition, sys.site_prefix and sys.site_exec_prefix are created -
if not in a virtual env, these have the same values as sys.prefix and
sys.exec_prefix. With just these changes, the basics of a virtual environment
are provided (in terms of isolation from other environments and the system
Python). However, in order to be useful, the packaging tools have to work with
sys.site_prefix and sys.site_exec_prefix, so changes have been made to
sysconfig, distutils and packaging to do this.

I'm presently working on a demonstration application which integrates the
above work with Doug Hellmann's virtualenvwrapper and Guillermo López' port of
it to Powershell to get a nice basic tool that'll support virtual environments
with packaging as an easy-to-use CLI, as well as Distribute support while
people migrate over to packaging, on Windows as well as Linux.

I'm expecting to cover both the Linux and Windows aspects (though I won't say
no to help ;-) and working through packaging issues relating to improved
Windows support. The basic functionality is there now, both in Windows and
Linux - the focus of work is in the ease-of-use CLI stuff which is not
envisaged to be part of core Python, but nevertheless needs to be done to make
virtual envs as painless as possible.

BTW Of the 398 packages on PyPI having a Py3K trove classifier, I've tested
installing all of them into a pythonv virtual env with Distribute, and 310
install without errors. Of the remaining 88, some are due to missing
dependencies, others due to broken packages on PyPI.

BTW of the Python regression test suite passes all tests in a pythonv
virtualenv, other than those for which there already are tracker issues for
the default branch in  hg.python.org/cpython (test_lib2to3, test_packaging,
test_sysconfig). Full test results are at [3].

All in all, it's looking reasonably good, and we hope to report more progress
on the PEP and the proof of concept soon!


Vinay Sajip

[1] http://goo.gl/6u0S0
[2] https://bitbucket.org/vinay.sajip/pythonv
[3] https://gist.github.com/1022705

More information about the Python-Dev mailing list