Skip to content

Fix overlapping lock entries for dependency extras - #11264

Open
dimbleby wants to merge 1 commit into
python-poetry:mainfrom
dimbleby:fix-11262
Open

dimbleby wants to merge 1 commit into
python-poetry:mainfrom
dimbleby:fix-11262

Conversation

@dimbleby

Copy link
Copy Markdown
Contributor

When two extras of a dependency pin the same version on one platform, Poetry can also lock a fallback version for that platform. It drops extra conditions instead of checking which extras the dependency uses.

Evaluate extras in the package that declares them, and keep a fallback only where none of the requirements apply. Leave the original dependency metadata intact.

Fixes #11262


GPT-generated; and I confess that I haven't thought about it hard to enough to be able to say that I understand every line of the fix. It looks about right and the tests pass.

I have more or less reached the point where I am willing to trust the AI on such things - if the testcases look good, if the code is cleanly factored; and if I have pressed it hard enough and it still insists that it has done a good job.

Reviewers may or may not feel the same way.

@sourcery-ai

sourcery-ai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit 963e433

#11262 poetry lock >= 2.5.0: overlapping markers for a package locked in two versions (torch / nvidia-cuda-nvrtc) · 1 of 1 met

# Requirement Status Notes
1 Keep lock markers disjoint when dependency extras produce different versions of the same package. ✅ Met The new solver test verifies that the pinned version applies on x86_64 and the fallback version applies on aarch64, without both versions applying in either environment.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the extra-marker branches are combined incorrectly, the solver can select or record the wrong dependency version in a lockfile. Reverting fixes future resolutions, but lockfiles already generated with the wrong result need to be regenerated.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

When two extras of a dependency pin the same version on one platform,
Poetry can also lock a fallback version for that platform. It drops
extra conditions instead of checking which extras the dependency uses.

Evaluate extras in the package that declares them, and keep a fallback
only where none of the requirements apply. Leave the original dependency
metadata intact.

Fixes python-poetry#11262

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e67fac27-603e-43eb-a3fb-abbecba87656

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

poetry lock >= 2.5.0: overlapping markers for a package locked in two versions (torch / nvidia-cuda-nvrtc)

1 participant