-
Notifications
You must be signed in to change notification settings - Fork 760
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
Implement uv pip show
#2115
Implement uv pip show
#2115
Conversation
Dug around a bit and it seems like it's not too difficult to add the additional metadata, particularly |
@ChannyClaus - Separate PR would be preferred, thank you! |
Marking myself as reviewer on this, sorry for the delay. |
No worries! Thanks for taking a look. |
Hmm, seems unrelated, let me try re-triggering via an empty commit. |
CI is green again 😄 - seems like it was transient indeed. |
|
||
/// Show information about one or more installed packages. | ||
pub(crate) fn pip_show( | ||
mut packages: Vec<PackageName>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChannyClaus - I simplified things a bit here because this method only needs to accept a list of package names (unlike uninstall
which needs to accept a list of requirements files, etc.).
crates/uv/src/commands/pip_show.rs
Outdated
.path() | ||
.parent() | ||
.expect("package path is not root") | ||
.simplified_display() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChannyClaus - I think pip show
always shows the site-packages
location regardless of whether it's editable. It looks like pip show
has a separate Editable location
field for the editable source, so we can add that in a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're absolutely right, thanks for catching that - will look into that sometime, probably sometime this weekend.
5218034
to
e1ca46f
Compare
// Print a separator between packages. | ||
#[allow(clippy::print_stdout)] | ||
{ | ||
println!("---"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also had to change these back to using println
, because the printer
always prints to stderr
, but I think it's important that this info goes to stdout
, so we have to do it "manually" (by passing in quiet
, etc.). Something we could try to improve in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I improved the situation a bit here: #2227
Thanks @ChannyClaus! |
Summary
Implementation for #1594
The output will contain only the name, version and location of the packages for now but it should be extendable to include other information in the future.
Quite inexperienced with Rust, so please forgive me if there are things that obviously don't make sense 😭
Test Plan
Added a bunch of unit tests. The exit code behavior matches
pip
's behavior: