Last active
June 14, 2018 03:46
-
-
Save akashadhikari/acc31a95932b1c827b17839dace4c376 to your computer and use it in GitHub Desktop.
Brisk: A Custom Virtual Environment Wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Written by @akashadhikari (https://github.com/akashadhikari/) and @Bindeep (https://github.com/Bindeep/) | |
# NOTE: <path to your virtualenv listing> is where you set all of your venv directories | |
# eg: mine is set as /home/akash/.virtualenvs | |
workon() { | |
current_dir=$PWD | |
if [ $1 ] | |
then | |
cd '<path to your virtualenv listing>' && cd $1 && source 'bin/activate' && cd $current_dir | |
else | |
cd '<path to your virtualenv listing>' && ls -la | |
fi | |
} | |
makeenv() { | |
current_dir=$PWD | |
if [ $1 ] | |
then | |
cd '<path to your virtualenv listing>' && python3 -m venv $1 && cd $current_dir | |
else | |
echo "Please make sure you enter the name of your new virtual environment. For eg: makeenv my_virtual_env" | |
fi | |
} | |
delenv() { | |
current_dir=$PWD | |
if [ $1 ] | |
then | |
cd '<path to your virtualenv listing>' && rm -rf $1 && cd $current_dir | |
else | |
echo "Please enter the name of virtual env you want to delete" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brisk: A Custom Virtual Environment Wrapper
Copy this script to your .bashrc or .zshrc and create a "virtual environment wrapper" in a blink of an eye.
Usage
To activate a virtual environment
workon <your_virtual_enironment_name>
To create a new virtual environment
makeenv <new_virtual_environment>
To delete a virtual environment
delenv <your_virtual_enironment_name>
To be continued... ;)