virtualenv helper tool
Shell
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 3 commits ahead, 2 commits behind brianm:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
venv.bash

README.md

To use, place venv.bash somewhere and source it, a la:

. venv.bash

You can do this by hand or put it in your ~/.bashrc, which I suggest for ongoing use.

Once it is "installed" via that eval, it defines a venv function which supports:

venv [create <name>]
     [destroy <name>]
     [use <name>]
     [ls]

to create, destroy, use, and list virtual environments respectively.

Demo:

brianm@binky:~$
brianm@binky:~$ venv create spiffy
New python executable in /Users/brianm/.venv/spiffy/bin/python
Installing setuptools............done.
Installing pip...............done.
brianm@binky:~$ venv use spiffy
(spiffy)brianm@binky:~$ which python
/Users/brianm/.venv/spiffy/bin/python
(spiffy)brianm@binky:~$ venv ls
spiffy
(spiffy)brianm@binky:~$ deactivate 
brianm@binky:~$ 

Use $VENV_PROMPT_COLOR to set an ansi color code for the color of the virtual env name in the prompt. I like VENV_PROMPT_COLOR='38;5;53' in xterm-256color. In traditional 16 color xterm-color I would tend towards VENV_PROMPT_COLOR='0;35'.

Use $VENV_DIR if you don't want virtual environments stored in ~/.venv.