Draft: Add uv license
command
#10292
Draft
+2,229
−182
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add a new command,
uv license
, to uv to assist with dependency license audit needs in response to #8156. Design of command arguments loosely informed by https://crates.io/crates/cargo-license.Example invocation:
As of right now, the implementation is very rough, with this PR intended to gather feedback on the approach, with the initial focus on pulling license information from Trove classifiers. A refined implementation would pivot to following PEP-639 guidelines, return license information as SPDX expressions, and gracefully fall back to Trove, and finally the (legacy?) license field.
I'd like feedback on whether or not the current approach:
license()
method onPackage
objects to trigger calls toDistributionDatabase.get_or_build_wheel_metadata
sensible? is a better way that I am missing that would be minimally disruptive to the overalluv
codebase?Metadata
-related structs within the codebase which explicitly comment that they contain only the subset of fields required for dependency resolution. Adding additional optional fields here breaks this constraint and I'm not sure if is desirable or would be acceptable to the maintainers.Note: the display code is entirely copied from
uv tree
and cut down. I would rewrite to enable display organized by package or license/serialization to machine-readable summary, etc.Any feedback appreciated. I am new to both the uv codebase and Rust, but will continue on this if we can agree on an approach.