python-poetry / python-poetry/poetry
What to do in case of certain configurations of dependencies being both mandatory and optional?
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.
Issue
Let's say I want to provide a latest extra for my package where certain dependencies are used with a higher version. For example something like this
[tool.poetry]
name = "example"
version = "0.1.0"
description = "Just an example"
[tool.poetry.dependencies]
python = "^3.8"
celery = "^3"
celery = { version="^4", optional = true }
[tool.poetry.extras]
latest = ["celery"]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
This can't work because duplicate keys are not allowed. Neither the docs for extra dependencies nor for extended dependency specification offer a solution for this problem. Maybe it's too niche, but I've seen it in the wild a couple of times already, for example in trying to delegate extras down the chain (e.g. a redis extra installing redis and celery[redis], with base celery already being a requirement).
Am I missing something, or am I doing something wrong?
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 with the duplicate dependency example in pyproject.toml, then read the linked documentation sections on extra dependencies and multiple-constraint dependencies. Determine how mandatory and optional versions should be represented and resolved, and document or implement a complete supported behavior for the example.
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
- Needs clarification
- Newbie friendliness
- 25/100