-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
area/cliRelated to the command lineRelated to the command linekind/bugSomething isn't working as expectedSomething isn't working as expected
Description
Description
This is derived from #10587, original discussion can be found in here: #10587 (comment).
A mimimum example:
# legacy style
# before removal
[tool.poetry]
package-mode = false
[tool.poetry.group.foo.dependencies]
fastapi = "^0.119.0"
[tool.poetry.group.foo]
include-groups = ["bar",]
[tool.poetry.group.bar.dependencies]
redis = "^6.4.0"
# after removal
[tool.poetry.group.foo.dependencies]
fastapi = "^0.119.0"
[tool.poetry.group.foo]
include-groups = ["bar",]
# -------------
# pep735 style
# before removal
[dependency-groups]
bar = ["redis (>=6.4.0,<7.0.0)",]
foo = [
{include-group="bar"},
"fastapi (>=0.119.0,<0.120.0)",
]
# after removal
[dependency-groups]
foo = [
{include-group="bar"},
"fastapi (>=0.119.0,<0.120.0)",
]For both cases, After removing an empty dependency group bar, running poetry command will fail due to Group 'foo' includes group 'bar' which is not defined.
Analysis
poetry remove would delete all empty dependency groups while leaving the include-group(pep735) or include-groups unchanged.
Proposed Solution
- Option 1: Do not change the logic, let the user handle this manually by adding the dependency group again before running any command.
- Option 2: For both formats, delete all include related logic for the deleted group.
- Option 3: Logic changed but slight difference between two formats:
- For pep735, delete allinclude-groupfor that group.
- For lecay format, do not delete the group or theinclude-groups.
Workarounds
Manually edit the pyproject.toml after removal of empty group
Poetry Installation Method
pipx
Operating System
MacOS Tahoe 26.0.1
Poetry Version
Poetry (version 2.2.1)
Poetry Configuration
xxPython Sysconfig
sysconfig.log
Paste the output of 'python -m sysconfig', over this line.
Example pyproject.toml
Poetry Runtime Logs
poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.
Metadata
Metadata
Assignees
Labels
area/cliRelated to the command lineRelated to the command linekind/bugSomething isn't working as expectedSomething isn't working as expected