Shell utility for python
function venv() {
###
# pip install virtualenv
# pip install virtualenvwrapper
###
# virtualenvwrapper
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
fi
# virutal env dir
export ENV_NAME=$(basename `pwd`)
export VIRTUALENV_PATH=$WORKON_HOME/$ENV_NAME
deactivate
# create each time
if [ -d $VIRTUALENV_PATH ]; then
echo "$VIRTUALENV_PATH is Exists. Deleting..."
rm -rf $VIRTUALENV_PATH
fi
mkvirtualenv $(basename `pwd`)
pip install -r requirements.txt
# # create once
# if [ -d $VIRTUALENV_PATH ]; then
# workon $ENV_NAME
# else
# mkvirtualenv $(basename `pwd`)
# if [ -f requirements.txt ]; then
# pip install -r requirements.txt
# fi
# fi
}
function pyclean () {
find . -type f -name "*.py[co]" -delete
find . -type d -name "__pycache__" -delete
}