python-poetry / python-poetry/poetry
Support Groups as Extras
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Feature Request
There seems to be a few places where this issue is mentioned, but I don't see anything explicitly tracking it.
(Specifically @matthijskooijman's comment (point 2) 1644#issuecomment-895848818)
The new groups functionality is very helpful when managing packages installed while developing a project, but seems to miss a pretty good use case - basically using groups in place of extras when installing this package in another environment.
Instead of having to do:
# myproject_1
[tool.poetry.dependencies]
package_1 = "^0.0.1"
[tool.poetry.group.group_a]
optional = true
# this lets someone else develop this project with optional deps
[tool.poetry.group.group_a.dependencies]
package_2 = {version = "^0.0.2", optional = true}
package_3 = {version = "^0.0.3", optional = true}
# need to explicitly define "extras" for other packages install optional deps
[tool.poetry.extras]
group_a = ["package_2", "package_3"]
It would be cleaner (and make more sense I think, once groups is out of preview), if we could just do:
# myproject_1
[tool.poetry.dependencies]
package_1 = "^0.0.1"
[tool.poetry.group.group_a]
optional = true
[tool.poetry.group.group_a.dependencies]
package_2 = "^0.0.2"
package_3 = "^0.0.3"
# didn't need to explicitly define "extras", or individual packages as "optional"
And then in myproject_2:
# myproject_2
[tool.poetry.dependencies]
myproject_1 = {version = "^1.0.0", extras = ["group_a"]}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing Poetry's existing dependency groups and extras behavior, using the TOML examples in the issue as the expected interface. Compare how optional groups are represented when this package is installed by another project, and define completion as allowing an extra to select a group without separately declaring each dependency optional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100