diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 92631e0..21decbd 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -450,3 +450,13 @@ unbkp() { fi done } + +# Create a virtual environment for python including a .envrc that loads the venv +create_venv() { + [[ ! -e venv ]] || return 0 + python -m venv venv + if (( $+commands[direnv] )); then + ln -s ~/.local/share/direnv/templates/python-venv.envrc .envrc + direnv allow + fi +}