Created
August 9, 2021 23:00
-
-
Save candeira/0be1f30eb53db42ffc0722e46ee5039e to your computer and use it in GitHub Desktop.
layout_poetry for direnv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" | |
} | |
gg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment