fix: detect Python package manager before installing in worktree setup#1109
Open
fix: detect Python package manager before installing in worktree setup#1109
Conversation
… setup The previous code unconditionally ran `poetry install` for any project containing pyproject.toml, breaking projects that use uv, pip, hatch, pdm, or plain setuptools — the vast majority of modern Python projects. New logic checks for [tool.poetry] in pyproject.toml, then falls back to uv sync (if uv.lock exists), pip install -r requirements.txt, or pip install -e . for generic pyproject.toml projects. Closes obra#1108
Bortlesboat
reviewed
Apr 10, 2026
Bortlesboat
left a comment
There was a problem hiding this comment.
I verified the issue against current main locally, and this keeps the fix nicely scoped to the broken Run Project Setup snippet in skills/using-git-worktrees/SKILL.md.
One follow-up worth considering, but not necessarily a blocker for this PR: uv-managed projects can exist without a committed uv.lock, so [tool.uv] (or a similarly explicit signal in pyproject.toml) may eventually be worth checking too. Even with that edge case, this is still a clear improvement over unconditional poetry install for every pyproject.toml project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1108
Problem
The
using-git-worktreesskill unconditionally ranpoetry installfor any project containing apyproject.toml:pyproject.tomlis now the standard Python project metadata file — it is used byuv,pip,hatch,pdm,setuptools, and many other tools, the vast majority of which are not Poetry. Runningpoetry installon these projects either fails outright (if Poetry is not installed) or produces an incorrect environment.Fix
Detect the actual package manager by inspecting file contents and lock files:
Detection heuristic:
[tool.poetry]inpyproject.tomlpoetry installuv.lockpresentuv syncrequirements.txtpresentpip install -r requirements.txtpyproject.tomlpip install -e .requirements.txtpip install -r requirements.txtPoetry projects are still handled correctly. Non-Poetry projects now get an appropriate install command instead of a Poetry error.
Changed Files
skills/using-git-worktrees/SKILL.md: updated "Run Project Setup" section