The excellent virtualenvwrapper supports a postmkvirtualenv script to bootstrap your virtual environments. Here's a useful implementation:
#!/usr/bin/env bash# Grab project name from virtualenv nameNAME=$(basename $VIRTUAL_ENV)# Set terminal title on postactivateecho"title $NAME"> $VIRTUAL_ENV/bin/postactivate
# Change directory to root of project on postactivate. We assume the# mkvirtualenv is being run from the root of the project. This line# will need to edited later if not.echo"cd $PWD">> $VIRTUAL_ENV/bin/postactivate
# Run postactivate now to get the title setsource$VIRTUAL_ENV/bin/postactivate
This ensures that a new virtualenv has a postactivate script which:
- Sets the terminal title to that of the virtualenv
- Changes directory to the root of the project
By convention, such ...