Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use an enum for virtual package export policy
  • Loading branch information
charliermarsh committed Oct 20, 2026
commit 2ec7a2d225e605d52130c5f74beaa5de991234f3
4 changes: 2 additions & 2 deletions 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,7 +360,7 @@ pub fn from_lock<'lock>(
groups,
annotate,
install_options,
|_| true,
VirtualPackages::Include,
)?;

nodes.sort_unstable_by_key(|node| &node.package.id);
Expand Down
25 changes: 21 additions & 4 deletions crates/uv-lock/src/lock/export/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@ pub(crate) use crate::lock::export::metadata::{
};
pub use crate::lock::export::pylock_toml::{PylockToml, PylockTomlError, PylockTomlErrorKind};
pub use crate::lock::export::requirements_txt::RequirementsTxtExport;
use crate::lock::{LockErrorKind, PackageIndex};
use crate::lock::{LockErrorKind, PackageIndex, Source};
use crate::{Installable, InstallableRootKind, LockError, Package};

pub mod cyclonedx_json;
mod metadata;
mod pylock_toml;
mod requirements_txt;

/// Whether to include virtual packages in the export.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum VirtualPackages {
Include,
Exclude,
}

/// A flat requirement, with its associated marker.
#[derive(Debug, Clone, PartialEq, Eq)]
struct ExportableRequirement<'lock> {
Expand All @@ -51,15 +58,15 @@ struct ExportableRequirements<'lock>(Vec<ExportableRequirement<'lock>>);
impl<'lock> ExportableRequirements<'lock> {
/// Generate the set of exportable [`ExportableRequirement`] entries from the given lockfile.
///
/// `emit_package` controls output visibility. Omitted packages still contribute dependencies.
/// Excluded virtual packages still contribute dependencies.
fn from_lock(
target: &impl Installable<'lock>,
prune: &[PackageName],
extras: &ExtrasSpecificationWithDefaults,
groups: &DependencyGroupsWithDefaults,
annotate: bool,
install_options: &'lock InstallOptions,
emit_package: impl Fn(&Package) -> bool,
virtual_packages: VirtualPackages,
) -> Result<Self, LockError> {
let size_guess = target.lock().packages.len();
let mut graph = Graph::<Node<'lock>, Edge<'lock>>::with_capacity(size_guess, size_guess);
Expand Down Expand Up @@ -304,7 +311,17 @@ impl<'lock> ExportableRequirements<'lock> {
}

let include_package = |package: &Package| {
emit_package(package)
let include_source = match &package.id.source {
Source::Virtual(_) => virtual_packages == VirtualPackages::Include,
Source::Registry(_)
| Source::Git(..)
| Source::Direct(..)
| Source::Path(_)
| Source::Directory(_)
| Source::Editable(_) => true,
};

include_source
&& install_options.include_package(
package.as_install_target(),
target.project_name(),
Expand Down
12 changes: 2 additions & 10 deletions 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,15 +793,7 @@ impl<'lock> PylockToml {
dev,
annotate,
install_options,
|package| match &package.id.source {
Source::Virtual(_) => false,
Source::Registry(_)
| Source::Git(..)
| Source::Direct(..)
| Source::Path(_)
| Source::Directory(_)
| Source::Editable(_) => true,
},
VirtualPackages::Exclude,
)?;

// Sort the nodes.
Expand Down
12 changes: 2 additions & 10 deletions 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,15 +45,7 @@ impl<'lock> RequirementsTxtExport<'lock> {
dev,
annotate,
install_options,
|package| match &package.id.source {
Source::Virtual(_) => false,
Source::Registry(_)
| Source::Git(..)
| Source::Direct(..)
| Source::Path(_)
| Source::Directory(_)
| Source::Editable(_) => true,
},
VirtualPackages::Exclude,
)?;

// Sort the nodes, such that unnamed URLs (editables) appear at the top.
Expand Down
Loading
⌂ 换网址