Personal tools
You are here: Home Weblog Archive 2007 December 06 Buildout and Virtualenv
Document Actions

Buildout and Virtualenv

by jfroche last modified 2007-12-08 14:56
Filed Under:

How and why use buildout with virtualenv

Buildout is this wonderful tool which helps you to automate setup and configuration of your applications.

Virtualenv is a tool which will help you to isolate your python environment

A few days ago I got stuck during a long time because I didn't see that one library I installed in my global site-packages of my favourite python 2.4 (on my ubuntu: /usr/lib/python2.4/site-packages/) was a lower version of a library I was using in my buildout. Package was sqlalchemy 0.4 in my global sites-package and my buildout based application was using sqlalchemy 0.3.8 ... Here is a simple solution to avoid this kind of things.

Idea is to start buildout with a python free of any external library. Virtualenv is the answer.


Install Virtualenv

Easy:

$ easy_install virtualenv

you will have then a file that you can run: /usr/bin/virtualenv

Let's say you have a buildout configuration go into it:

$ cd myApp.buildout
$ ls -l
bootstrap.py
buildout.cfg

Now you just have to create the python environment without any access to the global site-packages with virtualenv:
$ virtualenv --no-site-packages .
You will have then your new python in the bin folder :
$ ls -l bin
activate
easy_install
easy_install-2.4
python2.4

You can now run the buildout configuration with your new python:
$ ./bin/python2.4 bootstrap.py
$ ./bin/buildout
This will create you a nice and totally isolated environment ...

virtual python recipe

Posted by Anonymous User at 2007-12-09 12:59
Have'nt tried it myself, but there's a virtual python recipe:

http://pypi.python.org/pypi/tl.buildout_virtual_python/0.1.2

I think it dies not use virtualenv, though.
(seletz)

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: