[Distutils] repeatable and updatable virtualenv

Chris Withers chris at simplistix.co.uk
Tue Mar 16 14:35:00 CET 2010


Carl Meyer wrote:
> 
> Chris Withers wrote:
>> How can I set up a virtualenv in such a way that I can version control
>> the packages and their versions that are installed in it?
> 
> You'd use pip together with virtualenv (which is easy because every
> virtualenv nowadays comes with pip pre-installed), and you'd
> version-control a requirements file containing package names and versions.

Okay, but I think you said at pycon that pip won't work with binary or 
.egg distributions?

Does it play nicely with multiple indexes, some of which may be private 
and require http authentication?

> If all the package names in your requirements.txt are version-pinned,
> then "$VENV/bin/pip install -r requirements.txt" will ensure that you
> have those versions of all those packages installed. The only thing it
> won't do for you is remove packages that are no longer in
> requirements.txt; you'd need to do that yourself with "pip uninstall
> packagename" - not that having extra packages installed matters, generally.

Well, it can matter if you accidentally end up relying on them...

> Alternatively, if you want to be paranoid and you don't mind things
> being a little slower (though not much if you have a local
> PIP_DOWNLOAD_CACHE), you just create a new virtualenv each time you
> deploy. 

That won't necessarily fly... where would you put data files? outside 
the virtualenv? feels a bit weird to me, but that may just be a 
hysterical raisin...

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk


More information about the Distutils-SIG mailing list