Package: venvwrap
venvwrapA collection of bash functions for python venv mangementInstallvia pippip install venvwrap
source bin/venvwrap.shvia githubgit clone https://github.com/hunkeydee/venvwrap
sha256sum -c venvwrap/sha256
source venvwrap/venvwrap.shAsciicast Demosbasic create, pip-install, use, destroycreate venvs from varied python versionslink packages between venvsBash Environment and File System effectsThe script exports the following variables and default values.  Change them as needed before installation.VENV_HOME="${HOME}"/.venvs-> Default folder for venv directoriesVENV_PY=$(which python3)-> Default python installationIf the$VENV_HOMEdirectory does not already exist on the file system, this script will create it.All venvwrap commands are bash functions, with a small reliance on common binaries (rmandln).Usagevenvmk- Create venv(s), installs pip, wheel, setuptoolsusage: venvmk <venv>...

  ex: `venvmk alpha` -> creates a venv called 'alpha'
  ex: `venvmk bravo charlie` -> creates two seperate venvs
  ex: `venvmk delta -p /opt/bin/python3.6\` -> create venv using alt pythonvenvrm- Delete venv(s)usage: venvrm <venv>...

  ex: `venvrm delta` -> deletes the venv called 'delta'
  ex: `venvrm echo foxtrot` deletes two venvsworkon- Enter/activate a venvusage: workon <venv>

  ex: `workon golf` -> activates the 'golf' venv contextvenvex- Exit/deactivate the current venvusage: venvex

  ex: `venvex` -> deactivates the current venvvenvls- List all virtual environments managed by venvwrapusage: venvls

  ex `venvls` -> returns a dir listing of $VENV_HOMEvenvpkgls- List packages installed or linked in venv(s)usage: venvpkgls <venv>...

  ex: `venvpkgls juliet` -> runs pip list for 'juliet', then displays link in the site-packages directoryvenvcmd- Run cmd in venvusage: venvcmd <venv> <cmd>

  ex: `venvcmd kilo python3 ./server.py` -> runs server.py in 'kilo' venv.  note that in this case ./server.py would need to be placed at ~/.venvs/kilo/server.py.venvinstall- Install pip package(s) in venvusage: venvinstall <venv> <pkg>...'

  ex: `venvinstall mike urllib3` -> installs urllib3 in 'mike'
  ex: `venvinstall november numpy chardet` -> installs numpy and chardetvenvlink- link a package from  source venv> to target venvusage: venvlink <source_venv> <source_pkg> <target_venv>

  ex: venvlink oscar matplotlib papa` -> creates a link in 'papa' pointing to the matplotlib package in oscarBackgroundI didn't know enough about venvs (or bash scripting), so I spent a weekend learning/making this project.  Its generally inspired byvirtualenvwrapper.  Instead of wrapping virtualenv, these functions support the built-in pythonvenv.I think you can use virtualenvwrapper to wrap venvs since they're almost equivilent, but just using someone elses code means I learn less.The main feature I wanted to add while making this script was to have the ability to link packages between virtual environments.  Imagine you have a need to setup three seperate venvs, but they all need the samenumpy.  You could installnumpyin all three, but that wastes time, filespace and bandwidth.venvlinkworks around this by placing link files in the site-packages dir to the installed packages of other venvs.  For example,venvlink alpha numpy bravowould take thenumpypackage already installed inalpha, and make a link file to it withinbravo's site-packages.  This lets me set up a flexible development environment without duplicating lots of files.Very little effort was put into testing against other linux systems.It works for mewith bash 5.0.3 running on Debian Buster as well as Windows 10 wsl.  I tested python mangement withpython3.7.3directly from debian apt packages, as well aspython3.6.10,python3.7.7, andpython3.8.3compiled directly from python.org.  All currently supported versions of python (May 2020) tested successful.Some dependencies include:pythonother cmdspython3bashpython3-venvrmlnpython3-pip