-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Issue Kind
Brand new capability
Description
Now that PEP 735 [dependency-groups]
is supported, the [tool.poetry.group.GROUPNAME]
tables can largely be omitted from pyproject.toml
. However, it appears that in Poetry 2.2.0 they continue to have the same behavior as in previous versions, defaulting to optional = false
. This is a reasonable choice, but given the ease by which (e.g.) a single group can be defined and requested for installation via command line, package developers may wish to declare most or all groups optional.
To accomplish this, propose defining a Boolean tool.poetry.default-group-optionality
key in the configuration, itself having a default false
value. This would expose and allow configuration of the default value for optional
for all groups.
Alternatively, perhaps this key could be under tool.poetry.group
somehow, but it is not immediately clear how it would be differentiated from a group name. Additionally, there may well be a clearer key name.
Impact
This would allow package developers to fully omit the [tool.poetry.group.GROUPNAME]
tables from their pyproject.toml
config. For configs with a large number of optional dependency groups, changing the default optionality could eliminate substantial extra complexity.
For comparison, I believe that pip
only installs specifically-requested groups (see https://pip.pypa.io/en/latest/user_guide/#dependency-groups).
This change should be backwards compatible.
Workarounds
Specify the following for each optional group:
[tool.poetry.group.GROUPNAME]
optional = true