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

Add --extra to uv add and enable fine grained updates #4566

Merged
merged 4 commits into from
Jun 26, 2024

Conversation

ibraheemdev
Copy link
Member

@ibraheemdev ibraheemdev commented Jun 26, 2024

Summary

  • Adds a --extra flag to uv add that allows activating extras without the PEP508 syntax.
  • uv add now errors if the update is ambiguous (e.g. the dependency is present twice with different markers)
  • uv add is smarter about updates. For example, uv add flask==3.0.0 followed by uv add flask --extra dotenv preserves the previous version specifier.

Resolves #4419.

@ibraheemdev ibraheemdev force-pushed the ibraheem/uv-add-update branch from 9d7793f to 65b723a Compare June 26, 2024 21:03
fn update_requirement(old: &mut Requirement, new: Requirement, has_source: bool) {
// Add any new extras.
old.extras.extend(new.extras);
old.extras.dedup();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to sort?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so? This is updating pyproject.toml not the lockfile.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But dedup only deduplicates adjacent entries, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, fixed. I wonder if extras should be a HashSet..

@ibraheemdev ibraheemdev force-pushed the ibraheem/uv-add-update branch from 65b723a to 682939f Compare June 26, 2024 21:22
@ibraheemdev ibraheemdev disabled auto-merge June 26, 2024 22:26
@ibraheemdev ibraheemdev enabled auto-merge (squash) June 26, 2024 22:35
@ibraheemdev ibraheemdev merged commit a8c28c4 into main Jun 26, 2024
47 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/uv-add-update branch June 26, 2024 22:36
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

Successfully merging this pull request may close these issues.

uv add should support extras
2 participants