Skip to content

What to do in case of certain configurations of dependencies being both mandatory and optional? #2868

@a-recknagel

Description

@a-recknagel
  • 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureFeature requests/implementationsstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions