-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Add uv license
command
#10292
base: main
Are you sure you want to change the base?
Conversation
Maybe we could consider using |
I had actually started with that, but abandoned it because you may not want to show a tree. You may want to get a list of all dependencies and their licenses, or you may want to group by licenses, etc. I am not opposed if that's a consensus, the bigger issue is getting the data. With all that said, until PEP-639 is ratified and becomes commonplace, this will necessarily be a bit of a minefield, and we would have to be very careful about what guarantees are made about the data returned (none), and deal with the fact that licenses may be displayed in inconsistent ways depending on the source project. |
@charliermarsh would you mind weighing in on the approach and if you would be supportive to the inclusion of this if cleaned up? |
213daf4
to
a9e7185
Compare
b2c8627
to
7152a7c
Compare
7152a7c
to
d548b00
Compare
I can own taking a look at the broad place of this in our interface. |
Thanks @zanieb! Two questions: |
I'm all for some sort of command to query license information, but there are other, similar use-cases like auditing dependencies for vulnerabilities. I don't want to have a new top-level command for each thing, so this is loosely blocked on the design of a top-level Related |
Fair enough. I'll push forward with the machinery of the license data collection then. We could potentially separate this into two efforts: |
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.