Repository navigation
fix poetry update <dep> where <dep> is a transitive dependency - #10885
Merged
Merged
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- When building
all_dependencies, consider canonicalizing the names fromlocked_repository().packages(e.g. viacanonicalize_name) so that the membership check againstcanonicalize_name(p)is case/normalization-robust for both declared and locked dependencies.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- When building `all_dependencies`, consider canonicalizing the names from `locked_repository().packages` (e.g. via `canonicalize_name`) so that the membership check against `canonicalize_name(p)` is case/normalization-robust for both declared and locked dependencies.
## Individual Comments
### Comment 1
<location path="src/poetry/console/commands/update.py" line_range="76-78" />
<code_context>
+ # pyproject where the lockfile has not caught up yet)
+ # - locked deps in poetry.lock (covers transitive deps that
+ # are not declared directly in pyproject.toml)
all_dependencies = {dep.name for dep in self.poetry.package.all_requires}
+ all_dependencies |= {
+ p.name for p in self.poetry.locker.locked_repository().packages
+ }
</code_context>
<issue_to_address>
**issue (bug_risk):** Align dependency names with `canonicalize_name` to avoid mismatches for normalized package names.
`invalid_packages` uses `canonicalize_name(p)` for user input, but `all_dependencies` uses raw `dep.name` / `p.name`. If those aren’t already normalized the same way (dashes vs underscores, case), valid packages may be flagged as invalid. Consider building `all_dependencies` from `canonicalize_name(dep.name)` and `canonicalize_name(p.name)` so both sides of the comparison are normalized consistently.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
radoering
force-pushed
the
fix-update-transitive-dep
branch
from
May 8, 2026 15:03
ee811fb to
dfc37d2
Compare
Secrus
approved these changes
May 8, 2026
mwalbeck
pushed a commit
to mwalbeck/docker-python-poetry
that referenced
this pull request
May 24, 2026
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [poetry](https://github.com/python-poetry/poetry) ([changelog](https://python-poetry.org/history/)) | patch | `2.4.0` → `2.4.1` | --- ### Release Notes <details> <summary>python-poetry/poetry (poetry)</summary> ### [`v2.4.1`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#241---2026-05-09) [Compare Source](python-poetry/poetry@2.4.0...2.4.1) ##### Changed - Re-allow `installer==0.7.0` ([#​10887](python-poetry/poetry#10887)). ##### Fixed - Fix an issue where `poetry update <package>` failed when `<package>` was a transitive dependency ([#​10885](python-poetry/poetry#10885)). </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNzAuMTkiLCJ1cGRhdGVkSW5WZXIiOiI0My4xNzAuMTkiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=--> Reviewed-on: https://git.walbeck.it/mwalbeck/docker-python-poetry/pulls/1744
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Pull Request Check List
#10721 broke
poetry update <dep>in cases where<dep>is not declared in pyproject.toml but only a transitive dependency. This PR fixes the regression.