From e552394abb2a6fc14ef3265a327841025719abcb Mon Sep 17 00:00:00 2001 From: Andrii Barabash Date: Wed, 19 Feb 2025 21:49:24 +0100 Subject: [PATCH] Fixed poetry-env plugin for Poetry >=2.0.0 Since version 2.0.0 poetry stopped using '[project.tool]' section in `pyproject.toml`. So the plugin didn't work for the newer poetry version. With this change, the plugin will check for `pyproject.toml` and `poetry.lock` files to reliably check if it's a poetry project. In my testing, it worked with both poetry versions 1.8.5 and 2.0.1. --- 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