Skip to content

Commit

Permalink
Add support for pip list --outdated
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Nov 7, 2024
1 parent 273f453 commit a66e53d
Show file tree
Hide file tree
Showing 9 changed files with 417 additions and 28 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions crates/uv-cli/src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,26 +167,19 @@ impl CompatArgs for PipCompileCompatArgs {
pub struct PipListCompatArgs {
#[clap(long, hide = true)]
disable_pip_version_check: bool,

#[clap(long, hide = true)]
outdated: bool,
}

impl CompatArgs for PipListCompatArgs {
/// Validate the arguments passed for `pip list` compatibility.
///
/// This method will warn when an argument is passed that has no effect but matches uv's
/// behavior. If an argument is passed that does _not_ match uv's behavior (e.g.,
/// `--outdated`), this method will return an error.
/// `--disable-pip-version-check`), this method will return an error.
fn validate(&self) -> Result<()> {
if self.disable_pip_version_check {
warn_user!("pip's `--disable-pip-version-check` has no effect");
}

if self.outdated {
return Err(anyhow!("pip's `--outdated` is unsupported"));
}

Ok(())
}
}
Expand Down
10 changes: 10 additions & 0 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1907,6 +1907,16 @@ pub struct PipListArgs {
#[arg(long, value_enum, default_value_t = ListFormat::default())]
pub format: ListFormat,

/// List outdated packages.
///
/// The latest version of each package will be shown alongside the installed version. Up-to-date
/// packages will be omitted from the output.
#[arg(long, overrides_with("no_outdated"))]
pub outdated: bool,

#[arg(long, overrides_with("outdated"), hide = true)]
pub no_outdated: bool,

/// Validate the Python environment, to detect packages with missing dependencies and other
/// issues.
#[arg(long, overrides_with("no_strict"))]
Expand Down
1 change: 1 addition & 0 deletions crates/uv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ petgraph = { workspace = true }
rayon = { workspace = true }
regex = { workspace = true }
reqwest = { workspace = true }
rkyv = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
Loading

0 comments on commit a66e53d

Please sign in to comment.