Skip to content

Instantly share code, notes, and snippets.

@dcode
Created May 4, 2022 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcode/9eff75e9c7765029cc42a93b497f564e to your computer and use it in GitHub Desktop.
Save dcode/9eff75e9c7765029cc42a93b497f564e to your computer and use it in GitHub Desktop.
# ~/.config/direnv/direnvrc
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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment