Skip to content

Instantly share code, notes, and snippets.

@kra3
Forked from hmarr/gist:1013596
Last active December 21, 2015 00:59
Show Gist options
  • Save kra3/6224580 to your computer and use it in GitHub Desktop.
Save kra3/6224580 to your computer and use it in GitHub Desktop.
Couple of virtualenvwrapper hooks

This folder contains hooks for virtualenvwrapper

If you are a Python developer, and haven't installed virtualenv already, go ahead install both virtualenv & virtualenvwrapper.

Features include:

  1. Go back to the directory you were before activating virtualenv upon deactivate call
  2. Install set of highly suggested helper libraries on virtual environment creation

This gist will auto install following python libraries:

  1. pep8 - Confirm to PEP8
  2. pyflakes - Checks Python source files for errors.
  3. nose - For unit tests
  4. coverage - Code coverage measurement
  5. ipdb - Ipython PDB (Debugger)
  6. ipython - Ipython interactive python shell
  7. sphinx - Documentation generator
  8. pastescript - Packaging helpers
  9. q - better debugging output
  10. Pycco - Document your code in markdown syntax (Not same as API doc, nor as Sphinx approach)
  11. autopep8 - automatically formats Python code to conform to the PEP 8

Candidates

Install

copy all the files in this directory into your virtaulenvwrapper $WORKON_HOME

git clone https://gist.github.com/kra3/6224580
cp -f 6224580/* $WORKON_HOME
rm -rf 6224580
#!/bin/bash
# Global virtualenvwrapper postactivate, lives in $WORKON_HOME/postactivate
# save current path before switching to project home
export PRE_VENV_ACTIVATE_DIR=`pwd`
# changing to project directory is done automatically by virtualenvwrapper
# provided you made the virtual env using mkproject OR
# you used setvirtualenvproject to associate a project folder with virtual env
#!/bin/bash
# Global virtualenvwrapper postactivate, lives in $WORKON_HOME/postdeactivate
if [ $PRE_VENV_ACTIVATE_DIR ]; then
cd $PRE_VENV_ACTIVATE_DIR
unset PRE_VENV_ACTIVATE_DIR
fi
#!/bin/bash
# This hook is run after a new virtualenv is activated.
curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
rm -f distribute_setup.py
easy_install pip==dev
pip install -r $WORKON_HOME/venv_hooks_py.txt
# Style guide, syntax, etc.,
pep8
autopep8
pyflakes
# Test & coverage
nose
#pytest
#mock
coverage
# Deebugging and experimentation
ipdb
ipython
q
# packaging
pastescript
# Documenting
sphinx
Pycco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment