what is it?
- augments existing shells with a new feature that can load and unload environment variables depending on the current directory
- can be used to automatically activate a python virtual environment
installation
sudo apt install direnv
edit shell .rc file (example for zsh, see documentation for other shells)
eval "$(direnv hook zsh)"configuration
in python project directory containing the virtual environmment directory create a .envrc file
cd <PYTHON_PROJECT>
vim .envrcsource <VENV_NAME>/bin/activate
unset PS1allow direnv to make the changes
direnv allow