Automatically applying python env files is a bit of a headache.
There are some nvim plugins that attempt to attach a
venv(swenv.nvim is one) but they're not fully realised.
The cleanest solution I could find is to use direnv
-
Ubuntu
sudo apt install direnv
-
Add the following to the end of .zshrc
eval "$(direnv hook zsh)"
To allow direnv to automatically enable the virtual environtment,
add a .envrc file to your project that contains the following:
export VIRTUAL_ENV=<YOUR_PROJECT_ENV_DIR>
layout python3