direnv: layout_poetry
This commit is contained in:
parent
f9d403e03d
commit
e2adf59f4a
1 changed files with 15 additions and 0 deletions
|
|
@ -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"
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue