From d7e5fcbf6274bb02d56acd62a4ab2b4ee9a40a7e Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Thu, 21 Nov 2024 13:23:39 -0500 Subject: [PATCH] uv/pip/compile: slightly simplify conflicts This doesn't change any behavior. But this makes it a bit clearer in the code that `uv pip compile` does not support specifying conflicts. Indeed, we always pass an empty set of conflicts to the resolver. This is because there is no way to encode the conditional logic of conflicts into the `requirements.txt` format. This is unlike markers. --- crates/uv/src/commands/pip/compile.rs | 12 +++--------- crates/uv/src/lib.rs | 2 -- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/crates/uv/src/commands/pip/compile.rs b/crates/uv/src/commands/pip/compile.rs index f022f3158..885cef6e4 100644 --- a/crates/uv/src/commands/pip/compile.rs +++ b/crates/uv/src/commands/pip/compile.rs @@ -54,7 +54,6 @@ pub(crate) async fn pip_compile( constraints_from_workspace: Vec, overrides_from_workspace: Vec, environments: SupportedEnvironments, - conflicts: Conflicts, extras: ExtrasSpecification, output_file: Option<&Path>, resolution_mode: ResolutionMode, @@ -252,20 +251,15 @@ pub(crate) async fn pip_compile( }; // Determine the environment for the resolution. - let (tags, resolver_env, conflicting_groups) = if universal { + let (tags, resolver_env) = if universal { ( None, ResolverEnvironment::universal(environments.into_markers()), - conflicts, ) } else { let (tags, marker_env) = resolution_environment(python_version, python_platform, &interpreter)?; - ( - Some(tags), - ResolverEnvironment::specific(marker_env), - Conflicts::empty(), - ) + (Some(tags), ResolverEnvironment::specific(marker_env)) }; // Generate, but don't enforce hashes for the requirements. @@ -400,7 +394,7 @@ pub(crate) async fn pip_compile( tags.as_deref(), resolver_env.clone(), python_requirement, - conflicting_groups, + Conflicts::empty(), &client, &flat_index, &top_level_index, diff --git a/crates/uv/src/lib.rs b/crates/uv/src/lib.rs index 8ddecaa4a..f095ce86d 100644 --- a/crates/uv/src/lib.rs +++ b/crates/uv/src/lib.rs @@ -24,7 +24,6 @@ use uv_cli::{PythonCommand, PythonNamespace, ToolCommand, ToolNamespace, TopLeve #[cfg(feature = "self-update")] use uv_cli::{SelfCommand, SelfNamespace, SelfUpdateArgs}; use uv_fs::CWD; -use uv_pypi_types::Conflicts; use uv_requirements::RequirementsSource; use uv_scripts::{Pep723Item, Pep723Metadata, Pep723Script}; use uv_settings::{Combine, FilesystemOptions, Options}; @@ -333,7 +332,6 @@ async fn run(mut cli: Cli) -> Result { args.constraints_from_workspace, args.overrides_from_workspace, args.environments, - Conflicts::empty(), args.settings.extras, args.settings.output_file.as_deref(), args.settings.resolution,