Skip to content

Propose --no-extra Flag #9333

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

Closed
paultreadel opened this issue Nov 21, 2024 · 2 comments · Fixed by #9387
Closed

Propose --no-extra Flag #9333

paultreadel opened this issue Nov 21, 2024 · 2 comments · Fixed by #9387
Labels
enhancement New feature or improvement to existing functionality help wanted Contribution especially encouraged

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

@charliermarsh charliermarsh added enhancement New feature or improvement to existing functionality help wanted Contribution especially encouraged labels Nov 22, 2024
@paultreadel
Copy link
Author

Thanks for the prompt turnaround on the new feature! Already using it in v0.5.5 and its working great for handling conflicting extras and simplifying the commands required to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality help wanted Contribution especially encouraged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants