1
0
Fork 0

direnv: layout_poetry

This commit is contained in:
Jeremy Kaplan 2021-08-17 11:06:05 -07:00
commit e2adf59f4a

View file

@ -67,3 +67,18 @@ use_nvm() {
# Make sure to run `nvm install $node_version` first. # Make sure to run `nvm install $node_version` first.
nvm use $node_version nvm use $node_version
} }
# From https://github.com/direnv/direnv/wiki/Python#poetry
layout_poetry() {
if [[ ! -f pyproject.toml ]]; then
log_error 'No pyproject.toml found. Use `poetry new` or `poetry init` to create one first.'
exit 2
fi
# Create venv if it doesn't exist
poetry run true
export VIRTUAL_ENV="$(poetry env info --path)"
export POETRY_ACTIVE=1
PATH_add "$VIRTUAL_ENV/bin"
}