Remove marker from Edge (#14649)

It seems that this field is unused.
This commit is contained in:
konsti 2025-07-16 15:21:22 +01:00 committed by GitHub
parent 8b29ec0bfd
commit 7fece9b90a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 24 deletions

View file

@ -131,11 +131,11 @@ impl DerivationChain {
)); ));
let target = edge.source(); let target = edge.source();
let extra = match edge.weight() { let extra = match edge.weight() {
Edge::Optional(extra, ..) => Some(extra.clone()), Edge::Optional(extra) => Some(extra.clone()),
_ => None, _ => None,
}; };
let group = match edge.weight() { let group = match edge.weight() {
Edge::Dev(group, ..) => Some(group.clone()), Edge::Dev(group) => Some(group.clone()),
_ => None, _ => None,
}; };
queue.push_back((target, extra, group, path)); queue.push_back((target, extra, group, path));

View file

@ -1,6 +1,5 @@
use uv_distribution_filename::DistExtension; use uv_distribution_filename::DistExtension;
use uv_normalize::{ExtraName, GroupName, PackageName}; use uv_normalize::{ExtraName, GroupName, PackageName};
use uv_pep508::MarkerTree;
use uv_pypi_types::{HashDigest, HashDigests}; use uv_pypi_types::{HashDigest, HashDigests};
use crate::{ use crate::{
@ -202,12 +201,12 @@ impl Node {
} }
} }
/// An edge in the resolution graph, along with the marker that must be satisfied to traverse it. /// An edge in the resolution graph.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum Edge { pub enum Edge {
Prod(MarkerTree), Prod,
Optional(ExtraName, MarkerTree), Optional(ExtraName),
Dev(GroupName, MarkerTree), Dev(GroupName),
} }
impl From<&ResolvedDist> for RequirementSource { impl From<&ResolvedDist> for RequirementSource {

View file

@ -1152,7 +1152,7 @@ impl<'lock> PylockToml {
}; };
let index = graph.add_node(dist); let index = graph.add_node(dist);
graph.add_edge(root, index, Edge::Prod(package.marker)); graph.add_edge(root, index, Edge::Prod);
} }
Ok(Resolution::new(graph)) Ok(Resolution::new(graph))

View file

@ -13,7 +13,6 @@ use uv_configuration::ExtrasSpecificationWithDefaults;
use uv_configuration::{BuildOptions, DependencyGroupsWithDefaults, InstallOptions}; use uv_configuration::{BuildOptions, DependencyGroupsWithDefaults, InstallOptions};
use uv_distribution_types::{Edge, Node, Resolution, ResolvedDist}; use uv_distribution_types::{Edge, Node, Resolution, ResolvedDist};
use uv_normalize::{ExtraName, GroupName, PackageName}; use uv_normalize::{ExtraName, GroupName, PackageName};
use uv_pep508::MarkerTree;
use uv_platform_tags::Tags; use uv_platform_tags::Tags;
use uv_pypi_types::ResolverMarkerEnvironment; use uv_pypi_types::ResolverMarkerEnvironment;
@ -113,7 +112,7 @@ pub trait Installable<'lock> {
inverse.insert(&dist.id, index); inverse.insert(&dist.id, index);
// Add an edge from the root. // Add an edge from the root.
petgraph.add_edge(root, index, Edge::Prod(MarkerTree::TRUE)); petgraph.add_edge(root, index, Edge::Prod);
// Push the package onto the queue. // Push the package onto the queue.
roots.push((dist, index)); roots.push((dist, index));
@ -189,7 +188,7 @@ pub trait Installable<'lock> {
// a specific marker environment and set of extras/groups. // a specific marker environment and set of extras/groups.
// So at this point, we know the extras/groups have been // So at this point, we know the extras/groups have been
// satisfied, so we can safely drop the conflict marker. // satisfied, so we can safely drop the conflict marker.
Edge::Dev(group.clone(), dep.complexified_marker.pep508()), Edge::Dev(group.clone()),
); );
// Push its dependencies on the queue. // Push its dependencies on the queue.
@ -231,7 +230,7 @@ pub trait Installable<'lock> {
inverse.insert(&dist.id, index); inverse.insert(&dist.id, index);
// Add the edge. // Add the edge.
petgraph.add_edge(root, index, Edge::Prod(dependency.marker)); petgraph.add_edge(root, index, Edge::Prod);
// Push its dependencies on the queue. // Push its dependencies on the queue.
if seen.insert((&dist.id, None)) { if seen.insert((&dist.id, None)) {
@ -300,7 +299,7 @@ pub trait Installable<'lock> {
}; };
// Add the edge. // Add the edge.
petgraph.add_edge(root, index, Edge::Dev(group.clone(), dependency.marker)); petgraph.add_edge(root, index, Edge::Dev(group.clone()));
// Push its dependencies on the queue. // Push its dependencies on the queue.
if seen.insert((&dist.id, None)) { if seen.insert((&dist.id, None)) {
@ -484,9 +483,9 @@ pub trait Installable<'lock> {
index, index,
dep_index, dep_index,
if let Some(extra) = extra { if let Some(extra) = extra {
Edge::Optional(extra.clone(), dep.complexified_marker.pep508()) Edge::Optional(extra.clone())
} else { } else {
Edge::Prod(dep.complexified_marker.pep508()) Edge::Prod
}, },
); );

View file

@ -894,16 +894,11 @@ impl From<ResolverOutput> for uv_distribution_types::Resolution {
// Re-add the edges to the reduced graph. // Re-add the edges to the reduced graph.
for edge in graph.edge_indices() { for edge in graph.edge_indices() {
let (source, target) = graph.edge_endpoints(edge).unwrap(); let (source, target) = graph.edge_endpoints(edge).unwrap();
// OK to ignore conflicting marker because we've asserted
// above that we aren't in universal mode. If we aren't in
// universal mode, then there can be no conflicts since
// conflicts imply forks and forks imply universal mode.
let marker = graph[edge].pep508();
match (&graph[source], &graph[target]) { match (&graph[source], &graph[target]) {
(ResolutionGraphNode::Root, ResolutionGraphNode::Dist(target_dist)) => { (ResolutionGraphNode::Root, ResolutionGraphNode::Dist(target_dist)) => {
let target = inverse[&target_dist.name()]; let target = inverse[&target_dist.name()];
transformed.update_edge(root, target, Edge::Prod(marker)); transformed.update_edge(root, target, Edge::Prod);
} }
( (
ResolutionGraphNode::Dist(source_dist), ResolutionGraphNode::Dist(source_dist),
@ -913,11 +908,11 @@ impl From<ResolverOutput> for uv_distribution_types::Resolution {
let target = inverse[&target_dist.name()]; let target = inverse[&target_dist.name()];
let edge = if let Some(extra) = source_dist.extra.as_ref() { let edge = if let Some(extra) = source_dist.extra.as_ref() {
Edge::Optional(extra.clone(), marker) Edge::Optional(extra.clone())
} else if let Some(dev) = source_dist.dev.as_ref() { } else if let Some(dev) = source_dist.dev.as_ref() {
Edge::Dev(dev.clone(), marker) Edge::Dev(dev.clone())
} else { } else {
Edge::Prod(marker) Edge::Prod
}; };
transformed.add_edge(source, target, edge); transformed.add_edge(source, target, edge);