Skip to content

Instantly share code, notes, and snippets.

@hiono
Forked from candeira/direnvrc
Created December 16, 2021 04:46
Show Gist options
  • Save hiono/e073049133a5d56bee3c9f7f20ca5179 to your computer and use it in GitHub Desktop.
Save hiono/e073049133a5d56bee3c9f7f20ca5179 to your computer and use it in GitHub Desktop.
layout_poetry for direnv
# Layout Poetry originally from
# https://github.com/direnv/direnv/issues/592
layout_poetry() {
if [[ ! -f pyproject.toml ]]; then
log_error 'No pyproject.toml found. Use `poetry new` or `poetry init` to cr
exit 2
fi
local VENV=$(poetry env list --full-path | cut -d' ' -f1)
if [[ -z $VENV || ! -d $VENV/bin ]]; then
log_error 'No poetry virtual environment found. Use `poetry install` to cre
exit 2
fi
export VIRTUAL_ENV=$VENV
export POETRY_ACTIVE=1
PATH_add "$VENV/bin"
}
@hiono
Copy link
Author

hiono commented Dec 16, 2021

Removed the command 'gg'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment