darvid / zsh-poetry

🐚 Simple ZSH plugin for automatically activating and deactivating Poetry-created virtualenvs. 🐍
MIT License
73 stars 14 forks source link

Silently fail if pyproject.toml doesn't use poetry #15

Closed JasonGrace2282 closed 7 months ago

JasonGrace2282 commented 7 months ago

Current Behavior

Poetry yells about there being no [tool.poetry] in the pyproject.toml

Expected

There should be no output.

(Temporary?) Fix

Add the following code before defining venv in poetry.zsh:

# if pyproject doesn't use poetry fail silently
if [[ "$(poetry env list &> /dev/null; echo $?)" != "0" ]]; then
  return 1
fi

If there are concerns, this behavior should be toggleable via some environment variable.

NeilGirdhar commented 7 months ago

Do you want to create a PR?