python-poetry / python-poetry/poetry
Specify distinct dependency extras for distinct poetry project 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
Currently, adding an optional dependency to have in extras only allows one dependency per project. The issue here is that I may have two extras for my projects, say distributed and server, with ray and ray[serve] as dependencies respectively.
When I poetry add ray we modify the dependencies as
[tool.poetry.dependencies]
python = "^3.8"
ray = {version = "^1.2.0", optional = true}
and then when I add ray[serve] on top it modifies the dependencies as
[tool.poetry.dependencies]
python = "^3.8"
ray = {extras = ["serve"], version = "^1.2.0", optional = true}
getting rid of the default ray. Thus, I don't see any way to have something like
[tool.poetry.extras]
distributed = ["ray"]
server = ["ray[serve]"]
without also installing ray[serve] as part of the distributed extra!
I cannot think of any reason this would be desired behavior to not allow treating dependency extras as separate. While I haven't spent a great deal of time thinking about a design for a proposed solution, the above seems reasonable to me (that when specified in extras, a reference to ray does not include ray[serve] by default).
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
The issue names no implementation files or tests; start by tracing Poetry's dependency and project-extra handling for the two pyproject.toml examples. Done means distinct project extras can reference the same dependency with and without its dependency extra, without the broader dependency selection being included implicitly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100