Repository navigation
fix(add, remove): match --group against existing groups by normalized name - #11193
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Linked issues
#11192 `poetry add --group` and `poetry remove --group` do not match normalized group names · 1 of 2 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | poetry add --group targets an existing normalized group name in either group section. |
🟡 Partly met | The resolver finds existing names in both sections, but when a legacy group is selected and [dependency-groups] contains another group, add routes the dependency into [dependency-groups] and can create a duplicate normalized group. |
| 2 | poetry remove --group targets an existing normalized group name in either group section. |
✅ Met | The selected group is resolved against both [dependency-groups] and [tool.poetry.group] before removal. |
Sourcery assessment
Needs a human reviewer. If two declared group keys normalize to the same name, the first match can cause add or remove to edit the unintended group. The resulting manifest (and potentially lockfile) change persists after a revert, but is bounded and can be corrected manually.
1 of 2 tasks
8 tasks done
This branch has not been deployed
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.
Pull Request Check List
Resolves: #11192
Summary
poetry add --groupandpoetry remove --groupcompare the given group name against the keys inpyproject.tomlliterally. Whenpyproject.tomldeclares a group asMy_Group:poetry remove --group my-group <pkg>fails withThe following packages were not found.poetry add --group my-group <pkg>adds a separatemy-groupgroup. Poetry then rejects the project withDuplicate dependency group name after normalization.This change resolves
--groupto the existing key in[dependency-groups]or[tool.poetry.group]by comparing normalized names. If no group matches, the name is used as given, so new groups are created as before.Tests
test_add_to_existing_group_with_non_normalized_name(PEP 735 and legacy group)test_remove_from_group_with_non_normalized_name(PEP 735 and legacy group)All four tests fail without the change and pass with it.