A talk on virtualenv and pip
Well, here we go. The good, the bad and the ugly internals of Python packaging.
Let's get ready to rumble
First of all you need to bootstrap your environment.
hg clone http://bitbucket.org/dughh_talk cd dughh_talk bootstrap.[sh|bat]
Bear witness to teh magic!
Woohoo, what happened there?
Well easy, let's got through this step by step:
#!/bin/sh virtualenv --no-site-packages env source env/bin/activate easy_install pip pip install -r requirements.txt deactivate
Setup the virtual environment
Create a pristine python environment w/o any strings attached in env:
virtualenv --no-site-packages env
Activate the environment:
Bootstrap pip and install a package
First install pip:
Now install a package using pip:
pip install docutils
Freeze the environment
Now this is the interesting part.
pip freeze > requirements.txt
cat requirements.txt docutils==0.6
Install frozen requirements
Now let's install the packages from the file created before.
pip install -r requirements.txt