Skip to content

Instantly share code, notes, and snippets.

@algrebe
Created October 6, 2018 00:07
Show Gist options
  • Save algrebe/126c1b5efadbdf25275a9c464ee48285 to your computer and use it in GitHub Desktop.
Save algrebe/126c1b5efadbdf25275a9c464ee48285 to your computer and use it in GitHub Desktop.
Simple wrapper over python3's venv
#!/bin/bash
venvs=$HOME/.venv3
mkdir -p $venvs
venv3_mk() {
if [ "$#" -ne 1 ]
then
echo "Usage: venv3_mk <venv_name>"
return 1
fi
# TODO check if $1 exists, clean input
python3 -m venv $venvs/$1
}
venv3_activate() {
if [ "$#" -ne 1 ]
then
echo "Usage: venv3_activate <venv_name>"
return 1
fi
# TODO check if $1 exists, clean input
source $venvs/$1/bin/activate
}
venv3_ls() {
ls -1 $venvs
}
venv3_deactivate() {
deactivate
}
@algrebe
Copy link
Author

algrebe commented Oct 6, 2018

Usage:

source venv3.sh
venv3_mk blah
venv3_activate blah
venv3_deactivate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment