From 3a6f538109f02212adfdbcd36a202cb978b7f4d3 Mon Sep 17 00:00:00 2001 From: Jacob Rogers Date: Tue, 12 Aug 2025 15:12:20 +1200 Subject: [PATCH] fix(poetry-env): fix env detection for pyproject without [tool.poetry] Since version 2.0.0, poetry stopped requiring '[tool.poetry]' section in pyproject.toml and new environments are created without it, but the zsh plugin still required it. With this change, the plugin will check for `pyproject.toml` and `poetry.lock` files to reliably check if it's a poetry project. Tested with both poetry versions 1.8.5, 2.0.1 and 2.1.2. --- plugins/poetry-env/poetry-env.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/poetry-env/poetry-env.plugin.zsh b/plugins/poetry-env/poetry-env.plugin.zsh index dca388dfe..d2d571dbe 100644 --- a/plugins/poetry-env/poetry-env.plugin.zsh +++ b/plugins/poetry-env/poetry-env.plugin.zsh @@ -1,7 +1,7 @@ _togglePoetryShell() { # Determine if currently in a Poetry-managed directory local in_poetry_dir=0 - if [[ -f "$PWD/pyproject.toml" ]] && grep -q 'tool.poetry' "$PWD/pyproject.toml"; then + if [[ -f "$PWD/pyproject.toml" && -f "$PWD/poetry.lock" ]]; then in_poetry_dir=1 fi