A set of helper functions written in Bash that allow you to manage your Python3 venv environment in a convenient way. These functions are small improvements over similar bash scripts floating around the internet that implement these functions.
Python3andPython3-venv(obviously).- A UNIX shell with some standard programs/commands, i.e.,
command,basename,mkdir,ls.
Since the script simply exposes some global functions into your bash session
you can pretty much do whatever you want to install it -- you just need to make
sure that the file gets sourced somehow. Here are two options:
- Option 1: Copy the
.pyvenvwrapperfile anywhere onto your machine, then addsource /path/to/.pyvenvwrapperto your.bashrcor.bash_profile. - Option 2: Copy the source code in
.pyvenvwrapperinto your~/.bashrcor~/.bash_profilefile.
All virtual environments are stored in a ~/.venv folder by default.
You can change this folder to whichever folder you prefer by exporting a
VENV_HOME variable before sourcing .pyvenvwrapper.
Creates a python virtual environment at $VENV_HOME/[env-name].
Deletes a python virtual environment at $VENV_HOME/[env-name].
Provides a list of environment names currently stored in $VENV_HOME
Activates the environment located at $VENV_HOME/[env-name]. No need to
source the activate script in the environment folder!
Activates the environment loated at $VENV_HOME/[env-name] and changes your
directory to $VENV_PROJECT_FOLDER/[env-name].
Creates a python virtual environment at $VENV_HOME/[env-name], then creates a
directory at $VENV_PROJECT_FOLDER/[env-name], and then finally changes your
directory to that new directory.
Deactivates the currently active environment (if any).
Root folder where all python virtual environments are created.
Root folder where all python projects are created. This is where your source files go.
Set this to any value if you don't want to use a VENV_PROJECT_DIRECTORY and you
don't care whether it exists or not. This may affect whether workon and/or
mkproj commands are available to you.
Set this to any value if you don't want the mkvenv to upgrade pip to the
latest version immediately after creating the environment.
- Christopher Sabater Cordero - cs-cordero