Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ pub struct PipCompileArgs {
/// Include optional dependencies from the specified extra name; may be provided more than once.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
#[arg(long, value_delimiter = ',', conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>,

/// Include all optional dependencies.
Expand Down Expand Up @@ -1789,7 +1789,7 @@ pub struct PipSyncArgs {
/// Include optional dependencies from the specified extra name; may be provided more than once.
///
/// Only applies to `pylock.toml`, `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
#[arg(long, value_delimiter = ',', conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>,

/// Include all optional dependencies.
Expand Down Expand Up @@ -2158,7 +2158,7 @@ pub struct PipInstallArgs {
/// Include optional dependencies from the specified extra name; may be provided more than once.
///
/// Only applies to `pylock.toml`, `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
#[arg(long, value_delimiter = ',', conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>,

/// Include all optional dependencies.
Expand Down Expand Up @@ -3459,6 +3459,7 @@ pub struct RunArgs {
long,
conflicts_with = "all_extras",
conflicts_with = "only_group",
value_delimiter = ',',
value_parser = extra_name_with_clap_error,
value_hint = ValueHint::Other,
)]
Expand Down Expand Up @@ -3786,6 +3787,7 @@ pub struct SyncArgs {
long,
conflicts_with = "all_extras",
conflicts_with = "only_group",
value_delimiter = ',',
value_parser = extra_name_with_clap_error,
value_hint = ValueHint::Other,
)]
Expand Down Expand Up @@ -4793,7 +4795,7 @@ pub struct ExportArgs {
/// Include optional dependencies from the specified extra name.
///
/// May be provided more than once.
#[arg(long, conflicts_with = "all_extras", conflicts_with = "only_group", value_parser = extra_name_with_clap_error)]
#[arg(long, value_delimiter = ',', conflicts_with = "all_extras", conflicts_with = "only_group", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>,

/// Include all optional dependencies.
Expand Down
39 changes: 39 additions & 0 deletions crates/uv/tests/it/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9296,6 +9296,45 @@ fn sync_all_extras() -> Result<()> {
Ok(())
}

#[test]
fn sync_extra_comma_separated() -> Result<()> {
let context = TestContext::new("3.12");

let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(
r#"
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = []

[project.optional-dependencies]
types = ["typing-extensions>=4"]
async = ["anyio>3"]
"#,
)?;

context.lock().assert().success();

uv_snapshot!(context.filters(), context.sync().arg("--extra").arg("types,async"), @r#"
success: true
exit_code: 0
----- stdout -----

----- stderr -----
Resolved 5 packages in [TIME]
Prepared 4 packages in [TIME]
Installed 4 packages in [TIME]
+ anyio==4.3.0
+ idna==3.6
+ sniffio==1.3.1
+ typing-extensions==4.10.0
"#);

Ok(())
}

/// Sync all members in a workspace with dynamic extras.
#[test]
fn sync_all_extras_dynamic() -> Result<()> {
Expand Down
Loading