Skip to content

Conflicting groups should handle conflicting inclusions automatically #11232

@zanieb

Description

@zanieb

Summary

When using the include-group directive in dependency groups, uv does not propagate dependency group conflicts automatically. Instead, the conflicts must be manually enumerated. uv should be able to do this? Either by retaining the provenance of the included dependencies, or by just filling in more conflicts for the user before forwarding to the resolver.

Example

The following is required

[project]
name = "example"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = []

[dependency-groups]
dev = [
  { include-group = "test" },
]
test = ["tox>4"]
magic = ["tox<4"]

[tool.uv]
conflicts = [
  [
    { group = "test" },
    { group = "magic" },
  ],
  [
    { group = "dev" },
    { group = "magic" },
  ], 
]

But I would like to just do

[tool.uv]
conflicts = [
  [
    { group = "test" },
    { group = "magic" },
  ],
]

which fails with

❯ uv lock
  × No solution found when resolving dependencies:
  ╰─▶ Because example:magic depends on tox<4 and example:dev depends on tox>4, we can conclude that example:dev and
      example:magic are incompatible.
      And because your project requires example:dev and example:magic, we can conclude that your project's requirements
      are unsatisfiable.

While this example is contrived, you can imagine more complicated examples with multiple nested group inclusions and conflicts.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or improvement to existing functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions