From c05aca61db11474cbdbb92fb7d8e5f6bb0131d7c Mon Sep 17 00:00:00 2001 From: Aria Desires Date: Thu, 23 Jan 2025 15:43:07 -0500 Subject: [PATCH] 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. --- crates/uv-cli/src/lib.rs | 68 ----- crates/uv-settings/src/settings.rs | 46 +-- crates/uv/src/settings.rs | 28 +- crates/uv/tests/it/pip_compile.rs | 292 ------------------- crates/uv/tests/it/pip_install.rs | 434 ----------------------------- docs/reference/cli.md | 52 ---- docs/reference/settings.md | 112 -------- uv.schema.json | 37 --- 8 files changed, 5 insertions(+), 1064 deletions(-) diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index b48fed87f..ae3fa565f 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -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, - - /// Exclude dependencies from the specified dependency group. - /// - /// Only applies to `pyproject.toml` sources. - /// - /// May be provided multiple times. - #[arg(long)] - pub no_group: Vec, - - /// 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, - - /// 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, - - /// Exclude dependencies from the specified dependency group. - /// - /// Only applies to `pyproject.toml` sources. - /// - /// May be provided multiple times. - #[arg(long)] - pub no_group: Vec, - - /// 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, - - /// 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, diff --git a/crates/uv-settings/src/settings.rs b/crates/uv-settings/src/settings.rs index a109daf1b..17a43c6a0 100644 --- a/crates/uv-settings/src/settings.rs +++ b/crates/uv-settings/src/settings.rs @@ -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>, - /// 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>, - /// 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>, - /// 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>, - /// Include all groups. - /// - /// Only applies to `pyproject.toml` sources. - #[option( - default = "false", - value_type = "bool", - example = r#" - all-groups = true - "# - )] - pub all_groups: Option, /// Ignore package dependencies, instead only add those packages explicitly listed /// on the command line to the resulting the requirements file. #[option( diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs index 9bdb49505..f5984216b 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -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 diff --git a/crates/uv/tests/it/pip_compile.rs b/crates/uv/tests/it/pip_compile.rs index d316a69af..d4e41efc2 100644 --- a/crates/uv/tests/it/pip_compile.rs +++ b/crates/uv/tests/it/pip_compile.rs @@ -14430,295 +14430,3 @@ fn respect_index_preference() -> Result<()> { Ok(()) } - -#[test] -fn dependency_group() -> Result<()> { - fn new_context() -> 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"] - 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 { - 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::>(), 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(()) -} diff --git a/crates/uv/tests/it/pip_install.rs b/crates/uv/tests/it/pip_install.rs index ce7a381e0..990865c0f 100644 --- a/crates/uv/tests/it/pip_install.rs +++ b/crates/uv/tests/it/pip_install.rs @@ -8374,437 +8374,3 @@ fn direct_url_json_direct_url() -> Result<()> { Ok(()) } - -#[test] -fn dependency_group() -> Result<()> { - fn new_context() -> 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"] - 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 { - 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 { - 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::>(), 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(()) -} diff --git a/docs/reference/cli.md b/docs/reference/cli.md index f41ff31f9..15b7ccd7e 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -5492,12 +5492,6 @@ uv pip compile [OPTIONS] ...

Only applies to pyproject.toml, setup.py, and setup.cfg sources.

-
--all-groups

Include dependencies from all dependency groups.

- -

Only applies to pyproject.toml sources.

- -

--no-group can be used to exclude specific groups.

-
--allow-insecure-host allow-insecure-host

Allow insecure connections to a host.

Can be provided multiple times.

@@ -5622,12 +5616,6 @@ uv pip compile [OPTIONS] ...
--generate-hashes

Include distribution hashes in the output file

-
--group group

Include dependencies from the specified dependency group.

- -

Only applies to pyproject.toml sources.

- -

May be provided multiple times.

-
--help, -h

Display the concise help for this command

--index index

The URLs to use when resolving dependencies, in addition to the default index.

@@ -5727,12 +5715,6 @@ uv pip compile [OPTIONS] ...
--no-emit-package no-emit-package

Specify a package to omit from the output resolution. Its dependencies will still be included in the resolution. Equivalent to pip-compile’s --unsafe-package option

-
--no-group no-group

Exclude dependencies from the specified dependency group.

- -

Only applies to pyproject.toml sources.

- -

May be provided multiple times.

-
--no-header

Exclude the comment header at the top of the generated output file

--no-index

Ignore the registry index (e.g., PyPI), instead relying on direct URL dependencies and those provided via --find-links

@@ -5765,14 +5747,6 @@ uv pip compile [OPTIONS] ...

Multiple packages may be provided. Disable binaries for all packages with :all:. Clear previously specified packages with :none:.

-
--only-group only-group

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.

-
--output-file, -o output-file

Write the compiled requirements to the given requirements.txt file.

If the file already exists, the existing versions will be preferred when resolving dependencies, unless --upgrade is also specified.

@@ -6396,12 +6370,6 @@ uv pip install [OPTIONS] |--editable Only applies to pyproject.toml, setup.py, and setup.cfg sources.

-
--all-groups

Include dependencies from all dependency groups.

- -

Only applies to pyproject.toml sources.

- -

--no-group can be used to exclude specific groups.

-
--allow-insecure-host allow-insecure-host

Allow insecure connections to a host.

Can be provided multiple times.

@@ -6520,12 +6488,6 @@ uv pip install [OPTIONS] |--editable requires-python: Optimize for selecting latest supported version of each package, for each supported Python version -
--group group

Include dependencies from the specified dependency group.

- -

Only applies to pyproject.toml sources.

- -

May be provided multiple times.

-
--help, -h

Display the concise help for this command

--index index

The URLs to use when resolving dependencies, in addition to the default index.

@@ -6624,12 +6586,6 @@ uv pip install [OPTIONS] |--editable May also be set with the UV_NO_CONFIG environment variable.

--no-deps

Ignore package dependencies, instead only installing those packages explicitly listed on the command line or in the requirements files

-
--no-group no-group

Exclude dependencies from the specified dependency group.

- -

Only applies to pyproject.toml sources.

- -

May be provided multiple times.

-
--no-index

Ignore the registry index (e.g., PyPI), instead relying on direct URL dependencies and those provided via --find-links

--no-progress

Hide all progress outputs.

@@ -6657,14 +6613,6 @@ uv pip install [OPTIONS] |--editable Multiple packages may be provided. Disable binaries for all packages with :all:. Clear previously specified packages with :none:.

-
--only-group only-group

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.

-
--overrides overrides

Override versions using the given requirements files.

Overrides files are requirements.txt-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.

diff --git a/docs/reference/settings.md b/docs/reference/settings.md index a7d378e23..9f80d1b49 100644 --- a/docs/reference/settings.md +++ b/docs/reference/settings.md @@ -1692,34 +1692,6 @@ Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources. --- -#### [`all-groups`](#pip_all-groups) {: #pip_all-groups } - - -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 } @@ -2266,34 +2238,6 @@ Include distribution hashes in the output file. --- -#### [`group`](#pip_group) {: #pip_group } - - -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 } @@ -2655,34 +2599,6 @@ Exclude the specified optional dependencies if `all-extras` is supplied. --- -#### [`no-group`](#pip_no-group) {: #pip_no-group } - - -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 } @@ -2856,34 +2772,6 @@ Clear previously specified packages with `:none:`. --- -#### [`only-group`](#pip_only-group) {: #pip_only-group } - - -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 } diff --git a/uv.schema.json b/uv.schema.json index 65acf109b..9abf18d31 100644 --- a/uv.schema.json +++ b/uv.schema.json @@ -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": [