Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
741d178
Avoid propagating unrelated extras during export
charliermarsh Oct 19, 2026
ba20b8b
Use sparse conflict propagation for all exports
charliermarsh Oct 20, 2026
cc60964
Merge main after the export activation revert
charliermarsh Oct 20, 2026
dee0444
Limit conflict propagation to paths with marker readers
charliermarsh Oct 20, 2026
b1c2716
Resolve negative extra guards before exporting dependencies
charliermarsh Oct 20, 2026
84454f3
Resolve global extra activation after symbolic reachability
charliermarsh Oct 20, 2026
de1be33
Resolve uncertain export selections with complete activation models
charliermarsh Oct 20, 2026
860b983
Fold unconditional extra activations before symbolic export traversal
charliermarsh Oct 20, 2026
2ef9b4b
Track empty dependency groups in export conflicts
charliermarsh Oct 20, 2026
a8314d4
Respect group-only selection in export conflicts
charliermarsh Oct 20, 2026
a81ffff
Simplify export activation graph construction
charliermarsh Oct 20, 2026
3950259
Keep one pathological export benchmark
charliermarsh Oct 20, 2026
a779eaf
Use explicit export regression test cases
charliermarsh Oct 20, 2026
9b889b2
Remove exact fallback for recursive export conditions
charliermarsh Oct 20, 2026
2bdf686
Remove export benchmarks from activation changes
charliermarsh Oct 20, 2026
2ec7a2d
Use an enum for virtual package export policy
charliermarsh Oct 20, 2026
209d2fc
Clarify export activation analysis
charliermarsh Oct 20, 2026
cde2b42
Centralize export conflict variables
charliermarsh Oct 20, 2026
75235d4
Group export reachability state by node
charliermarsh Oct 20, 2026
e5c0998
Separate export component solving
charliermarsh Oct 20, 2026
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
3 changes: 2 additions & 1 deletion crates/uv-lock/src/lock/export/cyclonedx_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use uv_preview::{Preview, PreviewFeature};
use uv_pypi_types::HashAlgorithm;
use uv_warnings::warn_user;

use crate::lock::export::{ExportableRequirement, ExportableRequirements};
use crate::lock::export::{ExportableRequirement, ExportableRequirements, VirtualPackages};
use crate::lock::{LockErrorKind, Package, PackageId, RegistrySource, Source, WheelWireSource};
use crate::{Installable, LockError};

Expand Down Expand Up @@ -360,6 +360,7 @@ pub fn from_lock<'lock>(
groups,
annotate,
install_options,
VirtualPackages::Include,
)?;

nodes.sort_unstable_by_key(|node| &node.package.id);
Expand Down
871 changes: 642 additions & 229 deletions crates/uv-lock/src/lock/export/mod.rs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion crates/uv-lock/src/lock/export/pylock_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use uv_warnings::warn_user_once;

use uv_resolver_types::ResolverOutput;

use crate::lock::export::ExportableRequirements;
use crate::lock::export::{ExportableRequirements, VirtualPackages};
use crate::lock::{Source, WheelTagHint, is_wheel_unreachable};
use crate::{Installable, LockError};

Expand Down Expand Up @@ -793,6 +793,7 @@ impl<'lock> PylockToml {
dev,
annotate,
install_options,
VirtualPackages::Exclude,
)?;

// Sort the nodes.
Expand Down
3 changes: 2 additions & 1 deletion crates/uv-lock/src/lock/export/requirements_txt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use uv_normalize::PackageName;
use uv_pypi_types::{ParsedArchiveUrl, ParsedGitDirectoryUrl, ParsedGitPathUrl};
use uv_redacted::SafeUrl;

use crate::lock::export::{ExportableRequirement, ExportableRequirements};
use crate::lock::export::{ExportableRequirement, ExportableRequirements, VirtualPackages};
use crate::lock::{Package, PackageId, Source};
use crate::{Installable, LockError};

Expand Down Expand Up @@ -45,6 +45,7 @@ impl<'lock> RequirementsTxtExport<'lock> {
dev,
annotate,
install_options,
VirtualPackages::Exclude,
)?;

// Sort the nodes, such that unnamed URLs (editables) appear at the top.
Expand Down
9 changes: 9 additions & 0 deletions crates/uv-lock/src/lock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10153,6 +10153,15 @@ enum LockErrorKind {
/// The ID of the dependency whose inclusion is ambiguous.
dependency: PackageId,
},
/// Recursive extra conditions leave a package's export marker undetermined.
#[error(
"Cannot determine whether to export `{package}` because its dependency markers contain recursive extra conditions",
package = package.cyan()
)]
UnresolvedExportConflict {
/// The package whose inclusion remains undetermined.
package: PackageId,
},
/// An error that occurs when resolving metadata for a package.
#[error("Failed to generate package metadata for `{id}`", id = id.cyan())]
Resolution {
Expand Down
94 changes: 94 additions & 0 deletions crates/uv-pep508/src/marker/algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,100 @@ impl InternerGuard<'_> {
result
}

/// Substitute activation intervals without enumerating DNF paths.
pub(crate) fn resolve_extras_with_bounds(
&mut self,
marker: NodeId,
known_extras: &FxHashMap<ExtraName, (NodeId, NodeId)>,
) -> (NodeId, NodeId) {
self.resolve_extras_with_bounds_cached(marker, known_extras, &mut FxHashMap::default())
}

/// Transform each signed node once, computing both activation bounds together.
fn resolve_extras_with_bounds_cached(
&mut self,
marker: NodeId,
known_extras: &FxHashMap<ExtraName, (NodeId, NodeId)>,
cache: &mut FxHashMap<NodeId, (NodeId, NodeId)>,
) -> (NodeId, NodeId) {
if marker.is_true() || marker.is_false() {
return (marker, marker);
}
if let Some(&result) = cache.get(&marker) {
return result;
}

let node = self.shared.node(marker);
let result = if let (Variable::Extra(name), Edges::Boolean { high, low }) =
(&node.var, &node.children)
{
let (lower, upper) = known_extras
.get(name.extra())
.copied()
.unwrap_or((NodeId::FALSE, NodeId::FALSE));
debug_assert!(self.and(lower, upper.not()).is_false());

if lower.is_true() {
self.resolve_extras_with_bounds_cached(high.negate(marker), known_extras, cache)
} else if upper.is_false() {
self.resolve_extras_with_bounds_cached(low.negate(marker), known_extras, cache)
} else {
let (high_lower, high_upper) = self.resolve_extras_with_bounds_cached(
high.negate(marker),
known_extras,
cache,
);
let (low_lower, low_upper) =
self.resolve_extras_with_bounds_cached(low.negate(marker), known_extras, cache);

// An extra is definitely absent only outside its upper bound; it is possibly
// absent outside its lower bound. Negation therefore swaps the bounds.
let positive_lower = self.and(lower, high_lower);
let negative_lower = self.and(upper.not(), low_lower);
let mut result_lower = self.or(positive_lower, negative_lower);
if lower != upper {
// Both branches can guarantee the marker even when this extra is unknown:
// `x or y` is true if `y` is definitely true, regardless of `x`.
let consensus = self.and(high_lower, low_lower);
result_lower = self.or(result_lower, consensus);
}

let positive_upper = self.and(upper, high_upper);
let negative_upper = self.and(lower.not(), low_upper);
(result_lower, self.or(positive_upper, negative_upper))
}
} else {
let mut lower_changed = false;
let lower_children = node.children.map(marker, |child| {
let (lower, _) = self.resolve_extras_with_bounds_cached(child, known_extras, cache);
lower_changed |= lower != child;
lower
});

let mut upper_changed = false;
let upper_children = node.children.map(marker, |child| {
let (_, upper) = self.resolve_extras_with_bounds_cached(child, known_extras, cache);
upper_changed |= upper != child;
upper
});

let lower = if lower_changed {
self.rebuild_node(&node.var, lower_children)
} else {
marker
};
let upper = if upper_changed {
self.rebuild_node(&node.var, upper_children)
} else {
marker
};
(lower, upper)
};

cache.insert(marker, result);
result
}

/// Rebuild a decision after substitution, allowing children to introduce earlier variables.
/// Calling `create_node` directly would violate the diagram's variable ordering.
fn rebuild_node(&mut self, variable: &Variable, children: EdgeBuilder) -> NodeId {
Expand Down
Loading
Loading