Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propose --no-extra Flag #9333

Open
paultreadel opened this issue Nov 21, 2024 · 1 comment
Open

Propose --no-extra Flag #9333

paultreadel opened this issue Nov 21, 2024 · 1 comment

Comments

@paultreadel
Copy link

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" },
    ],
]
@charliermarsh
Copy link
Member

I think this makes sense given that --no-group exists \cc @zanieb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants