-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Propose --no-extra Flag #9333
Description
The new conflicting depencies handling introduced in 0.5.3 is great. Able to solve several project challenges with it.
To enhance the feature I'd propose adding a --no-extra flag allowing a specific extra group to be excluded when used with --all-extras.
With the config below running uv sync --all-extras results in an error.
Resolved 3 packages in 1ms
error: extra `extra1`, extra `extra2` are incompatible with the declared conflicts: {`uv-conflicts[extra1]`, `uv-conflicts[extra2]`}
I'd propose one option for handling this to allow the user to specify which of the conflicting extras to exclude. The option for this syntax could be helpful when the project has many optional extras where specifying each individual could become a long chain.
uv sync --all-extras --no-extra extra2
Similar functionality already exists for dependency groups with uv sync --all-groups --no-groups <NO_GROUP> and this could behave in a similar manner for extras as well.
[project]
name = "uv-conflicts"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []
[project.optional-dependencies]
extra1 = ["numpy==2.1.2"]
extra2 = ["numpy==2.0.0"]
[tool.uv]
conflicts = [
[
{ extra = "extra1" },
{ extra = "extra2" },
],
]