Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
51d75a9
Split out pip compile format options into new enum
thomasschafer Sep 22, 2025
2b382b6
Add CDX export format with empty JSON export
thomasschafer Sep 22, 2025
f2d9349
Export CDX with CDX metadata
snyk-will Sep 23, 2025
bda9b00
Add CDX initial metadata and component list
snyk-will Sep 23, 2025
2af75e5
Add test for basic CDX export
snyk-will Sep 23, 2025
7508199
Add tooling metadata field
snyk-will Sep 23, 2025
c053521
Add dependency tree to CDX output
snyk-will Sep 24, 2025
6d50b13
Tidy up dependency building and imports
thomasschafer Sep 24, 2025
f3447ae
Add tests for git deps and no deps
thomasschafer Sep 24, 2025
e7f4fc7
Update docs
thomasschafer Sep 24, 2025
35eb2c1
Fix linting errors
thomasschafer Sep 24, 2025
b6468e6
Move PipCompileFormat into export_format.rs
thomasschafer Sep 25, 2025
3e3e8ff
Update comments and return &str for package name
thomasschafer Sep 25, 2025
a5a8204
Add purl encoding
thomasschafer Sep 29, 2025
546bfff
Add more tests
thomasschafer Sep 29, 2025
1abfbf1
Add workspace information
thomasschafer Oct 15, 2025
271c927
Update component lookup
thomasschafer Oct 16, 2025
08436aa
Add markers
thomasschafer Oct 16, 2025
5dab6e0
Replace python:environment_marker with uv:marker
thomasschafer Oct 17, 2025
8fa0e3e
More fixes to properties
thomasschafer Oct 19, 2025
843c4fa
Merge pull request #5 from thomasschafer/sbom-export-support-2
thomasschafer Oct 27, 2025
815faaa
Guard sbom export behind preview flag
thomasschafer Oct 27, 2025
9f21a65
Update `cdx:python:package:marker` to `uv:package:marker`
thomasschafer Oct 28, 2025
64686bd
Update comment
thomasschafer Oct 29, 2025
8647def
Skip conflict detection for SBOMs
thomasschafer Oct 29, 2025
5950799
docs: uv export documentation
snyk-will Oct 27, 2025
605b59a
chore: add preview message
snyk-will Oct 29, 2025
1b72fea
fix: resolve conflicts after rebasing
thomasschafer Oct 30, 2025
162e668
Add preview link to note
thomasschafer Oct 30, 2025
042d730
Merge pull request #6 from thomasschafer/sbom-export-docs
thomasschafer Oct 30, 2025
afd04ac
Refactor component map
thomasschafer Oct 30, 2025
de35a94
Insert synthetic root when using `--all-packages` flag
thomasschafer Oct 30, 2025
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
148 changes: 148 additions & 0 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 @@ -103,6 +103,7 @@ configparser = { version = "3.1.0" }
console = { version = "0.16.0", default-features = false, features = ["std"] }
csv = { version = "1.3.0" }
ctrlc = { version = "3.4.5" }
cyclonedx-bom = { version = "0.8.0" }
dashmap = { version = "6.1.0" }
data-encoding = { version = "2.6.0" }
dotenvy = { version = "0.15.7" }
Expand Down
8 changes: 4 additions & 4 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use clap::{Args, Parser, Subcommand};
use uv_auth::Service;
use uv_cache::CacheArgs;
use uv_configuration::{
ExportFormat, IndexStrategy, KeyringProviderType, PackageNameSpecifier, ProjectBuildBackend,
TargetTriple, TrustedHost, TrustedPublishing, VersionControlSystem,
ExportFormat, IndexStrategy, KeyringProviderType, PackageNameSpecifier, PipCompileFormat,
ProjectBuildBackend, TargetTriple, TrustedHost, TrustedPublishing, VersionControlSystem,
};
use uv_distribution_types::{
ConfigSettingEntry, ConfigSettingPackageEntry, Index, IndexUrl, Origin, PipExtraIndex,
Expand Down Expand Up @@ -1306,7 +1306,7 @@ pub struct PipCompileArgs {
/// uv will infer the output format from the file extension of the output file, if
/// provided. Otherwise, defaults to `requirements.txt`.
#[arg(long, value_enum)]
pub format: Option<ExportFormat>,
pub format: Option<PipCompileFormat>,

/// Include extras in the output file.
///
Expand Down Expand Up @@ -4271,7 +4271,7 @@ pub struct TreeArgs {
pub struct ExportArgs {
/// The format to which `uv.lock` should be exported.
///
/// Supports both `requirements.txt` and `pylock.toml` (PEP 751) output formats.
/// Supports `requirements.txt`, `pylock.toml` (PEP 751) and `CycloneDX` v1.5 JSON output formats.
///
/// uv will infer the output format from the file extension of the output file, if
/// provided. Otherwise, defaults to `requirements.txt`.
Expand Down
26 changes: 26 additions & 0 deletions crates/uv-configuration/src/export_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,30 @@ pub enum ExportFormat {
#[serde(rename = "pylock.toml", alias = "pylock-toml")]
#[cfg_attr(feature = "clap", clap(name = "pylock.toml", alias = "pylock-toml"))]
PylockToml,
/// Export in `CycloneDX` v1.5 JSON format.
#[serde(rename = "cyclonedx1.5")]
#[cfg_attr(
feature = "clap",
clap(name = "cyclonedx1.5", alias = "cyclonedx1.5+json")
)]
CycloneDX1_5,
}

/// The output format to use in `uv pip compile`.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
pub enum PipCompileFormat {
/// Export in `requirements.txt` format.
#[default]
#[serde(rename = "requirements.txt", alias = "requirements-txt")]
#[cfg_attr(
feature = "clap",
clap(name = "requirements.txt", alias = "requirements-txt")
)]
RequirementsTxt,
/// Export in `pylock.toml` format.
#[serde(rename = "pylock.toml", alias = "pylock-toml")]
#[cfg_attr(feature = "clap", clap(name = "pylock.toml", alias = "pylock-toml"))]
PylockToml,
}
4 changes: 4 additions & 0 deletions crates/uv-preview/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ bitflags::bitflags! {
const FORMAT = 1 << 8;
const NATIVE_AUTH = 1 << 9;
const S3_ENDPOINT = 1 << 10;
const SBOM_EXPORT = 1 << 11;
}
}

Expand All @@ -40,6 +41,7 @@ impl PreviewFeatures {
Self::FORMAT => "format",
Self::NATIVE_AUTH => "native-auth",
Self::S3_ENDPOINT => "s3-endpoint",
Self::SBOM_EXPORT => "sbom-export",
_ => panic!("`flag_as_str` can only be used for exactly one feature flag"),
}
}
Expand Down Expand Up @@ -88,6 +90,7 @@ impl FromStr for PreviewFeatures {
"format" => Self::FORMAT,
"native-auth" => Self::NATIVE_AUTH,
"s3-endpoint" => Self::S3_ENDPOINT,
"sbom-export" => Self::SBOM_EXPORT,
_ => {
warn_user_once!("Unknown preview feature: `{part}`");
continue;
Expand Down Expand Up @@ -264,6 +267,7 @@ mod tests {
);
assert_eq!(PreviewFeatures::FORMAT.flag_as_str(), "format");
assert_eq!(PreviewFeatures::S3_ENDPOINT.flag_as_str(), "s3-endpoint");
assert_eq!(PreviewFeatures::SBOM_EXPORT.flag_as_str(), "sbom-export");
}

#[test]
Expand Down
4 changes: 4 additions & 0 deletions crates/uv-resolver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ uv-once-map = { workspace = true }
uv-pep440 = { workspace = true }
uv-pep508 = { workspace = true }
uv-platform-tags = { workspace = true }
uv-preview = { workspace = true }
uv-pypi-types = { workspace = true }
uv-python = { workspace = true }
uv-redacted = { workspace = true }
Expand All @@ -41,11 +42,13 @@ uv-small-str = { workspace = true }
uv-static = { workspace = true }
uv-torch = { workspace = true }
uv-types = { workspace = true }
uv-version = { workspace = true }
uv-warnings = { workspace = true }
uv-workspace = { workspace = true }

arcstr = { workspace = true }
clap = { workspace = true, features = ["derive"], optional = true }
cyclonedx-bom = { workspace = true }
dashmap = { workspace = true }
either = { workspace = true }
fs-err = { workspace = true, features = ["tokio"] }
Expand All @@ -55,6 +58,7 @@ indexmap = { workspace = true }
itertools = { workspace = true }
jiff = { workspace = true, features = ["serde"] }
owo-colors = { workspace = true }
percent-encoding = { workspace = true }
petgraph = { workspace = true }
pubgrub = { workspace = true }
rkyv = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-resolver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub use fork_strategy::ForkStrategy;
pub use lock::{
Installable, Lock, LockError, LockVersion, Package, PackageMap, PylockToml,
PylockTomlErrorKind, RequirementsTxtExport, ResolverManifest, SatisfiesResult, TreeDisplay,
VERSION,
VERSION, cyclonedx_json,
};
pub use manifest::Manifest;
pub use options::{Flexibility, Options, OptionsBuilder};
Expand Down
Loading