Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for conflicting groups #9096

Merged
merged 11 commits into from
Nov 14, 2024
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
25 changes: 22 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ glob = { version = "0.3.1" }
globset = { version = "0.4.15" }
globwalk = { version = "0.9.1" }
goblin = { version = "0.9.0", default-features = false, features = ["std", "elf32", "elf64", "endian_fd"] }
hashbrown = { version = "0.15.1" }
hex = { version = "0.4.3" }
home = { version = "0.5.9" }
html-escape = { version = "0.2.13" }
Expand Down
6 changes: 3 additions & 3 deletions crates/uv-bench/benches/uv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ mod resolver {
use uv_pep440::Version;
use uv_pep508::{MarkerEnvironment, MarkerEnvironmentBuilder};
use uv_platform_tags::{Arch, Os, Platform, Tags};
use uv_pypi_types::{ConflictingGroupList, ResolverMarkerEnvironment};
use uv_pypi_types::{Conflicts, ResolverMarkerEnvironment};
use uv_python::Interpreter;
use uv_resolver::{
FlatIndex, InMemoryIndex, Manifest, OptionsBuilder, PythonRequirement, RequiresPython,
Expand Down Expand Up @@ -163,7 +163,7 @@ mod resolver {
let options = OptionsBuilder::new().exclude_newer(exclude_newer).build();
let sources = SourceStrategy::default();
let dependency_metadata = DependencyMetadata::default();
let conflicting_groups = ConflictingGroupList::empty();
let conflicts = Conflicts::empty();

let python_requirement = if universal {
PythonRequirement::from_requires_python(
Expand Down Expand Up @@ -209,7 +209,7 @@ mod resolver {
options,
&python_requirement,
markers,
conflicting_groups,
conflicts,
Some(&TAGS),
&flat_index,
&index,
Expand Down
9 changes: 9 additions & 0 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2804,13 +2804,19 @@ pub struct SyncArgs {
///
/// May be provided more than once.
///
/// When multiple extras or groups are specified that appear in
/// `tool.uv.conflicts`, uv will report an error.
///
/// Note that all optional dependencies are always included in the resolution; this option only
/// affects the selection of packages to install.
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>,

/// Include all optional dependencies.
///
/// When two or more extras are declared as conflicting in
/// `tool.uv.conflicts`, using this flag will always result in an error.
///
/// Note that all optional dependencies are always included in the resolution; this option only
/// affects the selection of packages to install.
#[arg(long, conflicts_with = "extra")]
Expand Down Expand Up @@ -2841,6 +2847,9 @@ pub struct SyncArgs {

/// Include dependencies from the specified dependency group.
///
/// When multiple extras or groups are specified that appear in
/// `tool.uv.conflicts`, uv will report an error.
///
/// May be provided multiple times.
#[arg(long, conflicts_with("only_group"))]
pub group: Vec<GroupName>,
Expand Down
4 changes: 2 additions & 2 deletions crates/uv-dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use uv_distribution_types::{
};
use uv_git::GitResolver;
use uv_installer::{Installer, Plan, Planner, Preparer, SitePackages};
use uv_pypi_types::{ConflictingGroupList, Requirement};
use uv_pypi_types::{Conflicts, Requirement};
use uv_python::{Interpreter, PythonEnvironment};
use uv_resolver::{
ExcludeNewer, FlatIndex, Flexibility, InMemoryIndex, Manifest, OptionsBuilder,
Expand Down Expand Up @@ -188,7 +188,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
ResolverEnvironment::specific(marker_env),
// Conflicting groups only make sense when doing
// universal resolution.
ConflictingGroupList::empty(),
Conflicts::empty(),
Some(tags),
self.flat_index,
self.index,
Expand Down
1 change: 1 addition & 0 deletions crates/uv-pypi-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ uv-normalize = { workspace = true, features = ["schemars"] }
uv-pep440 = { workspace = true }
uv-pep508 = { workspace = true }

hashbrown = { workspace = true }
indexmap = { workspace = true, features = ["serde"] }
itertools = { workspace = true }
jiff = { workspace = true, features = ["serde"] }
Expand Down
Loading
Loading