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

## 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 https://github.com/astral-sh/uv/issues/4419.
This commit is contained in:
Ibraheem Ahmed 2024-06-26 18:36:07 -04:00 committed by GitHub
parent 95b4aacc25
commit a8c28c4612
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 331 additions and 68 deletions

View file

@ -1771,6 +1771,10 @@ pub struct AddArgs {
#[arg(long)]
pub branch: Option<String>,
/// Extras to activate for the dependency; may be provided more than once.
#[arg(long)]
pub extra: Option<Vec<ExtraName>>,
#[command(flatten)]
pub installer: ResolverInstallerArgs,