Skip to content
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
10 changes: 5 additions & 5 deletions crates/uv-distribution-types/src/resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ pub enum ResolutionDiagnostic {
/// The extra that was requested. For example, `colorama` in `black[colorama]`.
extra: ExtraName,
},
MissingDev {
MissingGroup {
/// The distribution that was requested with a non-existent development dependency group.
dist: ResolvedDist,
/// The development dependency group that was requested.
dev: GroupName,
group: GroupName,
},
YankedVersion {
/// The package that was requested with a yanked version. For example, `black==23.10.0`.
Expand All @@ -144,9 +144,9 @@ impl Diagnostic for ResolutionDiagnostic {
Self::MissingExtra { dist, extra } => {
format!("The package `{dist}` does not have an extra named `{extra}`")
}
Self::MissingDev { dist, dev } => {
Self::MissingGroup { dist, group } => {
format!(
"The package `{dist}` does not have a development dependency group named `{dev}`"
"The package `{dist}` does not have a development dependency group named `{group}`"
)
}
Self::YankedVersion { dist, reason } => {
Expand All @@ -170,7 +170,7 @@ impl Diagnostic for ResolutionDiagnostic {
fn includes(&self, name: &PackageName) -> bool {
match self {
Self::MissingExtra { dist, .. } => name == dist.name(),
Self::MissingDev { dist, .. } => name == dist.name(),
Self::MissingGroup { dist, .. } => name == dist.name(),
Self::YankedVersion { dist, .. } => name == dist.name(),
Self::MissingLowerBound { package_name } => name == package_name,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-resolver/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ fn collapse_no_versions_of_workspace_members(
// Then, if the package is a workspace member...
let (PubGrubPackageInner::Package { name, .. }
| PubGrubPackageInner::Extra { name, .. }
| PubGrubPackageInner::Dev { name, .. }) = &**package
| PubGrubPackageInner::Group { name, .. }) = &**package
else {
return;
};
Expand Down
8 changes: 4 additions & 4 deletions crates/uv-resolver/src/lock/export/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<'lock> ExportableRequirements<'lock> {
target: &impl Installable<'lock>,
prune: &[PackageName],
extras: &ExtrasSpecificationWithDefaults,
dev: &DependencyGroupsWithDefaults,
groups: &DependencyGroupsWithDefaults,
annotate: bool,
install_options: &'lock InstallOptions,
) -> Self {
Expand Down Expand Up @@ -76,7 +76,7 @@ impl<'lock> ExportableRequirements<'lock> {
.expect("found too many packages matching root")
.expect("could not find root");

if dev.prod() {
if groups.prod() {
// Add the workspace package to the graph.
let index = *inverse
.entry(&dist.id)
Expand All @@ -103,7 +103,7 @@ impl<'lock> ExportableRequirements<'lock> {
.dependency_groups
.iter()
.filter_map(|(group, deps)| {
if dev.contains(group) {
if groups.contains(group) {
Some(deps.iter().map(move |dep| (group, dep)))
} else {
None
Expand Down Expand Up @@ -163,7 +163,7 @@ impl<'lock> ExportableRequirements<'lock> {
.dependency_groups()
.iter()
.filter_map(|(group, deps)| {
if dev.contains(group) {
if groups.contains(group) {
Some(deps)
} else {
None
Expand Down
20 changes: 10 additions & 10 deletions crates/uv-resolver/src/lock/installable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub trait Installable<'lock> {
marker_env: &ResolverMarkerEnvironment,
tags: &Tags,
extras: &ExtrasSpecificationWithDefaults,
dev: &DependencyGroupsWithDefaults,
groups: &DependencyGroupsWithDefaults,
build_options: &BuildOptions,
install_options: &InstallOptions,
) -> Result<Resolution, LockError> {
Expand Down Expand Up @@ -74,7 +74,7 @@ pub trait Installable<'lock> {
})?;

// Track the activated extras.
if dev.prod() {
if groups.prod() {
activated_projects.push(&dist.id.name);
for extra in extras.extra_names(dist.optional_dependencies.keys()) {
activated_extras.push((&dist.id.name, extra));
Expand All @@ -85,7 +85,7 @@ pub trait Installable<'lock> {
for group in dist
.dependency_groups
.keys()
.filter(|group| dev.contains(group))
.filter(|group| groups.contains(group))
{
activated_groups.push((&dist.id.name, group));
}
Expand All @@ -106,7 +106,7 @@ pub trait Installable<'lock> {
})?;

// Add the workspace package to the graph.
let index = petgraph.add_node(if dev.prod() {
let index = petgraph.add_node(if groups.prod() {
self.package_to_node(dist, tags, build_options, install_options)?
} else {
self.non_installable_node(dist, tags)?
Expand All @@ -122,7 +122,7 @@ pub trait Installable<'lock> {

// Add the workspace dependencies to the queue.
for (dist, index) in roots {
if dev.prod() {
if groups.prod() {
// Push its dependencies onto the queue.
queue.push_back((dist, None));
for extra in extras.extra_names(dist.optional_dependencies.keys()) {
Expand All @@ -135,7 +135,7 @@ pub trait Installable<'lock> {
.dependency_groups
.iter()
.filter_map(|(group, deps)| {
if dev.contains(group) {
if groups.contains(group) {
Some(deps.iter().map(move |dep| (group, dep)))
} else {
None
Expand Down Expand Up @@ -172,7 +172,7 @@ pub trait Installable<'lock> {
// referenced as a development dependency, then we need to re-enable it.
let index = *entry.get();
let node = &mut petgraph[index];
if !dev.prod() {
if !groups.prod() {
*node = self.package_to_node(
dep_dist,
tags,
Expand Down Expand Up @@ -225,7 +225,7 @@ pub trait Installable<'lock> {
})?;

// Add the package to the graph.
let index = petgraph.add_node(if dev.prod() {
let index = petgraph.add_node(if groups.prod() {
self.package_to_node(dist, tags, build_options, install_options)?
} else {
self.non_installable_node(dist, tags)?
Expand Down Expand Up @@ -253,7 +253,7 @@ pub trait Installable<'lock> {
.dependency_groups()
.iter()
.filter_map(|(group, deps)| {
if dev.contains(group) {
if groups.contains(group) {
Some(deps.iter().map(move |dep| (group, dep)))
} else {
None
Expand Down Expand Up @@ -294,7 +294,7 @@ pub trait Installable<'lock> {
// referenced as a development dependency, then we need to re-enable it.
let index = *entry.get();
let node = &mut petgraph[index];
if !dev.prod() {
if !groups.prod() {
*node = self.package_to_node(dist, tags, build_options, install_options)?;
}
index
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-resolver/src/lock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl Lock {
)?;
}
}
if let Some(group) = dist.dev.as_ref() {
if let Some(group) = dist.group.as_ref() {
let id = PackageId::from_annotated_dist(dist, root)?;
let Some(package) = packages.get_mut(&id) else {
return Err(LockErrorKind::MissingDevBase {
Expand Down
6 changes: 3 additions & 3 deletions crates/uv-resolver/src/lock/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<'env> TreeDisplay<'env> {
depth: usize,
prune: &[PackageName],
packages: &[PackageName],
dev: &DependencyGroupsWithDefaults,
groups: &DependencyGroupsWithDefaults,
no_dedupe: bool,
invert: bool,
) -> Self {
Expand Down Expand Up @@ -95,7 +95,7 @@ impl<'env> TreeDisplay<'env> {
// Add an edge from the root.
graph.add_edge(root, index, Edge::Prod(None));

if dev.prod() {
if groups.prod() {
// Push its dependencies on the queue.
if seen.insert((id, None)) {
queue.push_back((id, None));
Expand All @@ -114,7 +114,7 @@ impl<'env> TreeDisplay<'env> {
.dependency_groups
.iter()
.filter_map(|(group, deps)| {
if dev.contains(group) {
if groups.contains(group) {
Some(deps.iter().map(move |dep| (group, dep)))
} else {
None
Expand Down
10 changes: 5 additions & 5 deletions crates/uv-resolver/src/pubgrub/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ impl PubGrubDependency {
pub(crate) fn from_requirement<'a>(
conflicts: &Conflicts,
requirement: Cow<'a, Requirement>,
dev: Option<&'a GroupName>,
group_name: Option<&'a GroupName>,
parent_package: Option<&'a PubGrubPackage>,
) -> impl Iterator<Item = Self> + 'a {
let parent_name = parent_package.and_then(|package| package.name_no_root());
let is_normal_parent = parent_package
.map(|pp| pp.extra().is_none() && pp.dev().is_none())
.map(|pp| pp.extra().is_none() && pp.group().is_none())
.unwrap_or(false);
let iter = if !requirement.extras.is_empty() {
// This is crazy subtle, but if any of the extras in the
Expand Down Expand Up @@ -128,7 +128,7 @@ impl PubGrubDependency {
url,
},
PubGrubPackageInner::Extra { name, .. } => {
if dev.is_none() {
if group_name.is_none() {
debug_assert!(
parent_name.is_none_or(|parent_name| parent_name != name),
"extras not flattened for {name}"
Expand All @@ -141,8 +141,8 @@ impl PubGrubDependency {
url,
}
}
PubGrubPackageInner::Dev { name, .. } => {
if dev.is_none() {
PubGrubPackageInner::Group { name, .. } => {
if group_name.is_none() {
debug_assert!(
parent_name.is_none_or(|parent_name| parent_name != name),
"group not flattened for {name}"
Expand Down
Loading
Loading