Script to set up Python virtualenv

This script sets up both python 2.* and python 3 virtual environments in a directory.

#! /bin/bash

# sets up the packages/python directory's virtualenvs 
# make sure these envs are in .gitignore
#
virtualenv env
virtualenv -p python3 env3

. env3/bin/activate
for i in pip grip requests setuptools six wheel mysqlclient coverage; do
    pip install $i
done

deactivate

. env/bin/activate
for i in pip setuptools; do
    pip install $i
done

deactivate

Why bother? Because this is a way to redeploy the environment on an empty computer. I prefer to save a setup script to the repo rather than the packages in the virtualenv. It takes less space, and encourages updating your code to remain compatible with the current libraries.

When you’re putting together packages, you need to correctly specify dependencies. To do that, you need to wipe out your packages, install your package, and test that it works.