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.
This commit is contained in:
Andrew Gallant 2024-11-21 13:23:39 -05:00 committed by Andrew Gallant
parent a66b0eb931
commit d7e5fcbf62
2 changed files with 3 additions and 11 deletions

View file

@ -54,7 +54,6 @@ pub(crate) async fn pip_compile(
constraints_from_workspace: Vec<Requirement>,
overrides_from_workspace: Vec<Requirement>,
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,

View file

@ -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<ExitStatus> {
args.constraints_from_workspace,
args.overrides_from_workspace,
args.environments,
Conflicts::empty(),
args.settings.extras,
args.settings.output_file.as_deref(),
args.settings.resolution,