temporarily disable new uv pip dependency-group flags (#10909)

We'll probably end up shipping but we were moving ahead with this on the
basis that pip may not even ship this, so let's play it safe and wait
for a bit.
This commit is contained in:
Aria Desires 2025-01-23 15:43:07 -05:00 committed by GitHub
parent 86f2f16d05
commit c05aca61db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 5 additions and 1064 deletions

View file

@ -1014,40 +1014,6 @@ pub struct PipCompileArgs {
#[arg(long, overrides_with("all_extras"), hide = true)]
pub no_all_extras: bool,
/// Include dependencies from the specified dependency group.
///
/// Only applies to `pyproject.toml` sources.
///
/// May be provided multiple times.
#[arg(long, conflicts_with("only_group"))]
pub group: Vec<GroupName>,
/// Exclude dependencies from the specified dependency group.
///
/// Only applies to `pyproject.toml` sources.
///
/// May be provided multiple times.
#[arg(long)]
pub no_group: Vec<GroupName>,
/// Only include dependencies from the specified dependency group.
///
/// The project itself will also be omitted.
///
/// Only applies to `pyproject.toml` sources.
///
/// May be provided multiple times.
#[arg(long, conflicts_with("group"))]
pub only_group: Vec<GroupName>,
/// Include dependencies from all dependency groups.
///
/// Only applies to `pyproject.toml` sources.
///
/// `--no-group` can be used to exclude specific groups.
#[arg(long, conflicts_with_all = [ "group", "only_group" ])]
pub all_groups: bool,
#[command(flatten)]
pub resolver: ResolverArgs,
@ -1606,40 +1572,6 @@ pub struct PipInstallArgs {
#[arg(long, overrides_with("all_extras"), hide = true)]
pub no_all_extras: bool,
/// Include dependencies from the specified dependency group.
///
/// Only applies to `pyproject.toml` sources.
///
/// May be provided multiple times.
#[arg(long, conflicts_with("only_group"))]
pub group: Vec<GroupName>,
/// Exclude dependencies from the specified dependency group.
///
/// Only applies to `pyproject.toml` sources.
///
/// May be provided multiple times.
#[arg(long)]
pub no_group: Vec<GroupName>,
/// Only include dependencies from the specified dependency group.
///
/// The project itself will also be omitted.
///
/// Only applies to `pyproject.toml` sources.
///
/// May be provided multiple times.
#[arg(long, conflicts_with("group"))]
pub only_group: Vec<GroupName>,
/// Include dependencies from all dependency groups.
///
/// Only applies to `pyproject.toml` sources.
///
/// `--no-group` can be used to exclude specific groups.
#[arg(long, conflicts_with_all = [ "group", "only_group" ])]
pub all_groups: bool,
#[command(flatten)]
pub installer: ResolverInstallerArgs,

View file

@ -13,7 +13,7 @@ use uv_distribution_types::{
};
use uv_install_wheel::linker::LinkMode;
use uv_macros::{CombineOptions, OptionsMetadata};
use uv_normalize::{ExtraName, GroupName, PackageName};
use uv_normalize::{ExtraName, PackageName};
use uv_pep508::Requirement;
use uv_pypi_types::{SupportedEnvironments, VerbatimParsedUrl};
use uv_python::{PythonDownloads, PythonPreference, PythonVersion};
@ -1111,50 +1111,6 @@ pub struct PipOptions {
"#
)]
pub no_extra: Option<Vec<ExtraName>>,
/// Include optional dependencies from the specified group; may be provided more than once.
///
/// Only applies to `pyproject.toml` sources.
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
group = ["dev", "docs"]
"#
)]
pub group: Option<Vec<GroupName>>,
/// Exclude optional dependencies from the specified group if `all-groups` are supplied
///
/// Only applies to `pyproject.toml` sources.
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
no-group = ["dev", "docs"]
"#
)]
pub no_group: Option<Vec<GroupName>>,
/// Exclude only dependencies from the specified group.
///
/// Only applies to `pyproject.toml` sources.
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
only-group = ["dev", "docs"]
"#
)]
pub only_group: Option<Vec<GroupName>>,
/// Include all groups.
///
/// Only applies to `pyproject.toml` sources.
#[option(
default = "false",
value_type = "bool",
example = r#"
all-groups = true
"#
)]
pub all_groups: Option<bool>,
/// Ignore package dependencies, instead only add those packages explicitly listed
/// on the command line to the resulting the requirements file.
#[option(

View file

@ -1513,10 +1513,6 @@ impl PipCompileSettings {
extra,
all_extras,
no_all_extras,
group,
no_group,
only_group,
all_groups,
build_constraints,
refresh,
no_deps,
@ -1621,10 +1617,6 @@ impl PipCompileSettings {
only_binary,
extra,
all_extras: flag(all_extras, no_all_extras),
group: Some(group),
no_group: Some(no_group),
only_group: Some(only_group),
all_groups: Some(all_groups),
no_deps: flag(no_deps, deps),
output_file,
no_strip_extras: flag(no_strip_extras, strip_extras),
@ -1767,10 +1759,6 @@ impl PipInstallSettings {
extra,
all_extras,
no_all_extras,
group,
no_group,
only_group,
all_groups,
installer,
refresh,
no_deps,
@ -1866,10 +1854,6 @@ impl PipInstallSettings {
strict: flag(strict, no_strict),
extra,
all_extras: flag(all_extras, no_all_extras),
group: Some(group),
no_group: Some(no_group),
only_group: Some(only_group),
all_groups: Some(all_groups),
no_deps: flag(no_deps, deps),
python_version,
python_platform,
@ -2655,10 +2639,6 @@ impl PipSettings {
extra,
all_extras,
no_extra,
group,
no_group,
only_group,
all_groups,
no_deps,
allow_empty_requirements,
resolution,
@ -2780,11 +2760,11 @@ impl PipSettings {
false,
false,
false,
args.group.combine(group).unwrap_or_default(),
args.no_group.combine(no_group).unwrap_or_default(),
Vec::new(),
Vec::new(),
false,
Vec::new(),
false,
args.only_group.combine(only_group).unwrap_or_default(),
args.all_groups.combine(all_groups).unwrap_or_default(),
),
dependency_mode: if args.no_deps.combine(no_deps).unwrap_or_default() {
DependencyMode::Direct

View file

@ -14430,295 +14430,3 @@ fn respect_index_preference() -> Result<()> {
Ok(())
}
#[test]
fn dependency_group() -> Result<()> {
fn new_context() -> Result<TestContext> {
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 = ["typing-extensions"]
[dependency-groups]
foo = ["sortedcontainers"]
bar = ["iniconfig"]
dev = ["sniffio"]
"#,
)?;
Ok(context)
}
let mut context;
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
Resolved 1 package in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("--only-group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml --only-group bar
iniconfig==2.0.0
----- stderr -----
Resolved 1 package in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("--group").arg("foo"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml --group foo
sortedcontainers==2.4.0
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
Resolved 2 packages in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("--group").arg("foo")
.arg("--group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml --group foo --group bar
iniconfig==2.0.0
sortedcontainers==2.4.0
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
Resolved 3 packages in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("--all-groups"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml --all-groups
iniconfig==2.0.0
sniffio==1.3.1
sortedcontainers==2.4.0
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
Resolved 4 packages in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("--all-groups")
.arg("--no-group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml --all-groups --no-group bar
sniffio==1.3.1
sortedcontainers==2.4.0
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
Resolved 3 packages in [TIME]
"###);
Ok(())
}
#[test]
fn many_pyproject_group() -> Result<()> {
fn new_context() -> Result<TestContext> {
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 = ["typing-extensions"]
[dependency-groups]
foo = ["sortedcontainers"]
"#,
)?;
let subdir = context.temp_dir.child("subdir");
subdir.create_dir_all()?;
let pyproject_toml2 = subdir.child("pyproject.toml");
pyproject_toml2.write_str(
r#"
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
[dependency-groups]
foo = ["iniconfig"]
bar = ["sniffio"]
"#,
)?;
Ok(context)
}
let mut context;
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("subdir/pyproject.toml"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml subdir/pyproject.toml
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
Resolved 1 package in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("subdir/pyproject.toml")
.arg("--all-groups"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml subdir/pyproject.toml --all-groups
iniconfig==2.0.0
sniffio==1.3.1
sortedcontainers==2.4.0
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
Resolved 4 packages in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("subdir/pyproject.toml")
.arg("--group").arg("foo"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml subdir/pyproject.toml --group foo
iniconfig==2.0.0
sortedcontainers==2.4.0
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
Resolved 3 packages in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("subdir/pyproject.toml")
.arg("--group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml subdir/pyproject.toml --group bar
sniffio==1.3.1
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
warning: The dependency-group 'bar' is not defined in pyproject.toml
Resolved 2 packages in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters().into_iter().chain([(
"warning: The dependency-group 'lies' is not defined in pyproject.toml\nwarning: The dependency-group 'lies' is not defined in subdir/pyproject.toml",
"warning: The dependency-group 'lies' is not defined in subdir/pyproject.toml\nwarning: The dependency-group 'lies' is not defined in pyproject.toml",
)]).collect::<Vec<_>>(), context.pip_compile()
.arg("pyproject.toml")
.arg("subdir/pyproject.toml")
.arg("--group").arg("lies"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml subdir/pyproject.toml --group lies
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
warning: The dependency-group 'lies' is not defined in subdir/pyproject.toml
warning: The dependency-group 'lies' is not defined in pyproject.toml
Resolved 1 package in [TIME]
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_compile()
.arg("pyproject.toml")
.arg("subdir/pyproject.toml")
.arg("--group").arg("foo")
.arg("--group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml subdir/pyproject.toml --group foo --group bar
iniconfig==2.0.0
sniffio==1.3.1
sortedcontainers==2.4.0
typing-extensions==4.10.0
# via project (pyproject.toml)
----- stderr -----
warning: The dependency-group 'bar' is not defined in pyproject.toml
Resolved 4 packages in [TIME]
"###);
Ok(())
}

View file

@ -8374,437 +8374,3 @@ fn direct_url_json_direct_url() -> Result<()> {
Ok(())
}
#[test]
fn dependency_group() -> Result<()> {
fn new_context() -> Result<TestContext> {
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 = ["typing-extensions"]
[dependency-groups]
foo = ["sortedcontainers"]
bar = ["iniconfig"]
dev = ["sniffio"]
"#,
)?;
context.lock().assert().success();
Ok(context)
}
let mut context;
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 1 package in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ typing-extensions==4.10.0
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("--only-group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 1 package in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ iniconfig==2.0.0
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("--group").arg("foo"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 2 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ sortedcontainers==2.4.0
+ typing-extensions==4.10.0
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("--group").arg("foo")
.arg("--group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 3 packages in [TIME]
Prepared 3 packages in [TIME]
Installed 3 packages in [TIME]
+ iniconfig==2.0.0
+ sortedcontainers==2.4.0
+ typing-extensions==4.10.0
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("--all-groups"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 4 packages in [TIME]
Prepared 4 packages in [TIME]
Installed 4 packages in [TIME]
+ iniconfig==2.0.0
+ sniffio==1.3.1
+ sortedcontainers==2.4.0
+ typing-extensions==4.10.0
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("--all-groups")
.arg("--no-group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 3 packages in [TIME]
Prepared 3 packages in [TIME]
Installed 3 packages in [TIME]
+ sniffio==1.3.1
+ sortedcontainers==2.4.0
+ typing-extensions==4.10.0
"###);
Ok(())
}
#[test]
fn dependency_group_default_groups() -> Result<()> {
fn new_context() -> Result<TestContext> {
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 = ["typing-extensions"]
[tool.uv]
default-groups = ["foo", "bar"]
[dependency-groups]
foo = ["sortedcontainers"]
bar = ["iniconfig"]
dev = ["sniffio"]
"#,
)?;
context.lock().assert().success();
Ok(context)
}
let mut context;
// We should not install the default groups
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 1 package in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ typing-extensions==4.10.0
"###);
// Selecting a group works as normal
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("--only-group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 1 package in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ iniconfig==2.0.0
"###);
Ok(())
}
#[test]
fn many_pyproject_group() -> Result<()> {
fn new_context() -> Result<TestContext> {
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 = ["typing-extensions"]
[dependency-groups]
foo = ["sortedcontainers"]
"#,
)?;
let subdir = context.temp_dir.child("subdir");
subdir.create_dir_all()?;
let pyproject_toml2 = subdir.child("pyproject.toml");
pyproject_toml2.write_str(
r#"
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
[dependency-groups]
foo = ["iniconfig"]
bar = ["sniffio"]
"#,
)?;
context.lock().assert().success();
Ok(context)
}
let mut context;
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("-r").arg("subdir/pyproject.toml"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 1 package in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ typing-extensions==4.10.0
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("-r").arg("subdir/pyproject.toml")
.arg("--all-groups"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 4 packages in [TIME]
Prepared 4 packages in [TIME]
Installed 4 packages in [TIME]
+ iniconfig==2.0.0
+ sniffio==1.3.1
+ sortedcontainers==2.4.0
+ typing-extensions==4.10.0
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("-r").arg("subdir/pyproject.toml")
.arg("--group").arg("foo"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 3 packages in [TIME]
Prepared 3 packages in [TIME]
Installed 3 packages in [TIME]
+ iniconfig==2.0.0
+ sortedcontainers==2.4.0
+ typing-extensions==4.10.0
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("-r").arg("subdir/pyproject.toml")
.arg("--group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
warning: The dependency-group 'bar' is not defined in pyproject.toml
Resolved 2 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ sniffio==1.3.1
+ typing-extensions==4.10.0
"###);
context = new_context()?;
uv_snapshot!(context.filters().into_iter().chain([(
"warning: The dependency-group 'lies' is not defined in pyproject.toml\nwarning: The dependency-group 'lies' is not defined in subdir/pyproject.toml",
"warning: The dependency-group 'lies' is not defined in subdir/pyproject.toml\nwarning: The dependency-group 'lies' is not defined in pyproject.toml",
)]).collect::<Vec<_>>(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("-r").arg("subdir/pyproject.toml")
.arg("--group").arg("lies"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
warning: The dependency-group 'lies' is not defined in subdir/pyproject.toml
warning: The dependency-group 'lies' is not defined in pyproject.toml
Resolved 1 package in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ typing-extensions==4.10.0
"###);
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("-r").arg("subdir/pyproject.toml")
.arg("--group").arg("foo")
.arg("--group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
warning: The dependency-group 'bar' is not defined in pyproject.toml
Resolved 4 packages in [TIME]
Prepared 4 packages in [TIME]
Installed 4 packages in [TIME]
+ iniconfig==2.0.0
+ sniffio==1.3.1
+ sortedcontainers==2.4.0
+ typing-extensions==4.10.0
"###);
Ok(())
}
#[test]
fn group_needs_manifest() {
let context = TestContext::new("3.12");
uv_snapshot!(context.filters(), context.pip_install()
.arg("sniffio")
.arg("--group").arg("foo"), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
error: Requesting groups requires a `pyproject.toml`.
"###);
}
#[test]
fn group_directory_target() -> 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 = ["typing-extensions"]
[dependency-groups]
foo = ["sortedcontainers"]
"#,
)?;
let subdir = context.temp_dir.child("subdir");
subdir.create_dir_all()?;
let pyproject_toml2 = subdir.child("pyproject.toml");
pyproject_toml2.write_str(
r#"
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
[dependency-groups]
foo = ["iniconfig"]
bar = ["sniffio"]
"#,
)?;
context.lock().assert().success();
// Targeting a directory does not allow selection of groups
uv_snapshot!(context.filters(), context.pip_install().arg(".").arg("--group").arg("foo"), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
error: Requesting groups requires a `pyproject.toml`.
"###);
// A subdirectory is the same
uv_snapshot!(context.filters(), context.pip_install().arg("subdir").arg("--group").arg("foo"), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
error: Requesting groups requires a `pyproject.toml`.
"###);
// Editables are the same
uv_snapshot!(context.filters(), context.pip_install().arg("-e").arg(".").arg("--group").arg("foo"), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
error: Requesting groups requires a `pyproject.toml`.
"###);
Ok(())
}

View file

@ -5492,12 +5492,6 @@ uv pip compile [OPTIONS] <SRC_FILE>...
<p>Only applies to <code>pyproject.toml</code>, <code>setup.py</code>, and <code>setup.cfg</code> sources.</p>
</dd><dt><code>--all-groups</code></dt><dd><p>Include dependencies from all dependency groups.</p>
<p>Only applies to <code>pyproject.toml</code> sources.</p>
<p><code>--no-group</code> can be used to exclude specific groups.</p>
</dd><dt><code>--allow-insecure-host</code> <i>allow-insecure-host</i></dt><dd><p>Allow insecure connections to a host.</p>
<p>Can be provided multiple times.</p>
@ -5622,12 +5616,6 @@ uv pip compile [OPTIONS] <SRC_FILE>...
</ul>
</dd><dt><code>--generate-hashes</code></dt><dd><p>Include distribution hashes in the output file</p>
</dd><dt><code>--group</code> <i>group</i></dt><dd><p>Include dependencies from the specified dependency group.</p>
<p>Only applies to <code>pyproject.toml</code> sources.</p>
<p>May be provided multiple times.</p>
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
</dd><dt><code>--index</code> <i>index</i></dt><dd><p>The URLs to use when resolving dependencies, in addition to the default index.</p>
@ -5727,12 +5715,6 @@ uv pip compile [OPTIONS] <SRC_FILE>...
</dd><dt><code>--no-emit-package</code> <i>no-emit-package</i></dt><dd><p>Specify a package to omit from the output resolution. Its dependencies will still be included in the resolution. Equivalent to pip-compile&#8217;s <code>--unsafe-package</code> option</p>
</dd><dt><code>--no-group</code> <i>no-group</i></dt><dd><p>Exclude dependencies from the specified dependency group.</p>
<p>Only applies to <code>pyproject.toml</code> sources.</p>
<p>May be provided multiple times.</p>
</dd><dt><code>--no-header</code></dt><dd><p>Exclude the comment header at the top of the generated output file</p>
</dd><dt><code>--no-index</code></dt><dd><p>Ignore the registry index (e.g., PyPI), instead relying on direct URL dependencies and those provided via <code>--find-links</code></p>
@ -5765,14 +5747,6 @@ uv pip compile [OPTIONS] <SRC_FILE>...
<p>Multiple packages may be provided. Disable binaries for all packages with <code>:all:</code>. Clear previously specified packages with <code>:none:</code>.</p>
</dd><dt><code>--only-group</code> <i>only-group</i></dt><dd><p>Only include dependencies from the specified dependency group.</p>
<p>The project itself will also be omitted.</p>
<p>Only applies to <code>pyproject.toml</code> sources.</p>
<p>May be provided multiple times.</p>
</dd><dt><code>--output-file</code>, <code>-o</code> <i>output-file</i></dt><dd><p>Write the compiled requirements to the given <code>requirements.txt</code> file.</p>
<p>If the file already exists, the existing versions will be preferred when resolving dependencies, unless <code>--upgrade</code> is also specified.</p>
@ -6396,12 +6370,6 @@ uv pip install [OPTIONS] <PACKAGE|--requirements <REQUIREMENTS>|--editable <EDIT
<p>Only applies to <code>pyproject.toml</code>, <code>setup.py</code>, and <code>setup.cfg</code> sources.</p>
</dd><dt><code>--all-groups</code></dt><dd><p>Include dependencies from all dependency groups.</p>
<p>Only applies to <code>pyproject.toml</code> sources.</p>
<p><code>--no-group</code> can be used to exclude specific groups.</p>
</dd><dt><code>--allow-insecure-host</code> <i>allow-insecure-host</i></dt><dd><p>Allow insecure connections to a host.</p>
<p>Can be provided multiple times.</p>
@ -6520,12 +6488,6 @@ uv pip install [OPTIONS] <PACKAGE|--requirements <REQUIREMENTS>|--editable <EDIT
<li><code>requires-python</code>: Optimize for selecting latest supported version of each package, for each supported Python version</li>
</ul>
</dd><dt><code>--group</code> <i>group</i></dt><dd><p>Include dependencies from the specified dependency group.</p>
<p>Only applies to <code>pyproject.toml</code> sources.</p>
<p>May be provided multiple times.</p>
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
</dd><dt><code>--index</code> <i>index</i></dt><dd><p>The URLs to use when resolving dependencies, in addition to the default index.</p>
@ -6624,12 +6586,6 @@ uv pip install [OPTIONS] <PACKAGE|--requirements <REQUIREMENTS>|--editable <EDIT
<p>May also be set with the <code>UV_NO_CONFIG</code> environment variable.</p>
</dd><dt><code>--no-deps</code></dt><dd><p>Ignore package dependencies, instead only installing those packages explicitly listed on the command line or in the requirements files</p>
</dd><dt><code>--no-group</code> <i>no-group</i></dt><dd><p>Exclude dependencies from the specified dependency group.</p>
<p>Only applies to <code>pyproject.toml</code> sources.</p>
<p>May be provided multiple times.</p>
</dd><dt><code>--no-index</code></dt><dd><p>Ignore the registry index (e.g., PyPI), instead relying on direct URL dependencies and those provided via <code>--find-links</code></p>
</dd><dt><code>--no-progress</code></dt><dd><p>Hide all progress outputs.</p>
@ -6657,14 +6613,6 @@ uv pip install [OPTIONS] <PACKAGE|--requirements <REQUIREMENTS>|--editable <EDIT
<p>Multiple packages may be provided. Disable binaries for all packages with <code>:all:</code>. Clear previously specified packages with <code>:none:</code>.</p>
</dd><dt><code>--only-group</code> <i>only-group</i></dt><dd><p>Only include dependencies from the specified dependency group.</p>
<p>The project itself will also be omitted.</p>
<p>Only applies to <code>pyproject.toml</code> sources.</p>
<p>May be provided multiple times.</p>
</dd><dt><code>--overrides</code> <i>overrides</i></dt><dd><p>Override versions using the given requirements files.</p>
<p>Overrides files are <code>requirements.txt</code>-like files that force a specific version of a requirement to be installed, regardless of the requirements declared by any constituent package, and regardless of whether this would be considered an invalid resolution.</p>

View file

@ -1692,34 +1692,6 @@ Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
---
#### [`all-groups`](#pip_all-groups) {: #pip_all-groups }
<span id="all-groups"></span>
Include all groups.
Only applies to `pyproject.toml` sources.
**Default value**: `false`
**Type**: `bool`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv.pip]
all-groups = true
```
=== "uv.toml"
```toml
[pip]
all-groups = true
```
---
#### [`allow-empty-requirements`](#pip_allow-empty-requirements) {: #pip_allow-empty-requirements }
<span id="allow-empty-requirements"></span>
@ -2266,34 +2238,6 @@ Include distribution hashes in the output file.
---
#### [`group`](#pip_group) {: #pip_group }
<span id="group"></span>
Include optional dependencies from the specified group; may be provided more than once.
Only applies to `pyproject.toml` sources.
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv.pip]
group = ["dev", "docs"]
```
=== "uv.toml"
```toml
[pip]
group = ["dev", "docs"]
```
---
#### [`index-strategy`](#pip_index-strategy) {: #pip_index-strategy }
<span id="index-strategy"></span>
@ -2655,34 +2599,6 @@ Exclude the specified optional dependencies if `all-extras` is supplied.
---
#### [`no-group`](#pip_no-group) {: #pip_no-group }
<span id="no-group"></span>
Exclude optional dependencies from the specified group if `all-groups` are supplied
Only applies to `pyproject.toml` sources.
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv.pip]
no-group = ["dev", "docs"]
```
=== "uv.toml"
```toml
[pip]
no-group = ["dev", "docs"]
```
---
#### [`no-header`](#pip_no-header) {: #pip_no-header }
<span id="no-header"></span>
@ -2856,34 +2772,6 @@ Clear previously specified packages with `:none:`.
---
#### [`only-group`](#pip_only-group) {: #pip_only-group }
<span id="only-group"></span>
Exclude only dependencies from the specified group.
Only applies to `pyproject.toml` sources.
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv.pip]
only-group = ["dev", "docs"]
```
=== "uv.toml"
```toml
[pip]
only-group = ["dev", "docs"]
```
---
#### [`output-file`](#pip_output-file) {: #pip_output-file }
<span id="output-file"></span>

37
uv.schema.json generated
View file

@ -864,13 +864,6 @@
"null"
]
},
"all-groups": {
"description": "Include all groups.\n\nOnly applies to `pyproject.toml` sources.",
"type": [
"boolean",
"null"
]
},
"allow-empty-requirements": {
"description": "Allow `uv pip sync` with empty requirements, which will clear the environment of all packages.",
"type": [
@ -1025,16 +1018,6 @@
"null"
]
},
"group": {
"description": "Include optional dependencies from the specified group; may be provided more than once.\n\nOnly applies to `pyproject.toml` sources.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/GroupName"
}
},
"index-strategy": {
"description": "The strategy to use when resolving against multiple index URLs.\n\nBy default, uv will stop at the first index on which a given package is available, and limit resolutions to those present on that first index (`first-index`). This prevents \"dependency confusion\" attacks, whereby an attacker can upload a malicious package under the same name to an alternate index.",
"anyOf": [
@ -1147,16 +1130,6 @@
"$ref": "#/definitions/ExtraName"
}
},
"no-group": {
"description": "Exclude optional dependencies from the specified group if `all-groups` are supplied\n\nOnly applies to `pyproject.toml` sources.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/GroupName"
}
},
"no-header": {
"description": "Exclude the comment header at the top of output file generated by `uv pip compile`.",
"type": [
@ -1202,16 +1175,6 @@
"$ref": "#/definitions/PackageNameSpecifier"
}
},
"only-group": {
"description": "Exclude only dependencies from the specified group.\n\nOnly applies to `pyproject.toml` sources.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/GroupName"
}
},
"output-file": {
"description": "Write the requirements generated by `uv pip compile` to the given `requirements.txt` file.\n\nIf the file already exists, the existing versions will be preferred when resolving dependencies, unless `--upgrade` is also specified.",
"type": [