Skip to content

Commit 2f553bf

Browse files
authored
Add a stub debug subcommand to uv pip announcing its intentional absence (#16966)
## Summary Inform users who encounter #16879 that `uv pip debug` is currently intentionally not implemented. ## Test Plan Added an integration test for the warning, ran the test suite.
1 parent 539b736 commit 2f553bf

5 files changed

Lines changed: 49 additions & 1 deletion

File tree

crates/uv-cli/src/lib.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,9 @@ pub enum PipCommand {
10091009
after_long_help = ""
10101010
)]
10111011
Check(PipCheckArgs),
1012+
/// Display debug information (unsupported)
1013+
#[command(hide = true)]
1014+
Debug(PipDebugArgs),
10121015
}
10131016

10141017
#[derive(Subcommand)]
@@ -2756,6 +2759,21 @@ pub struct PipTreeArgs {
27562759
pub compat_args: compat::PipGlobalCompatArgs,
27572760
}
27582761

2762+
#[derive(Args)]
2763+
pub struct PipDebugArgs {
2764+
#[arg(long, hide = true)]
2765+
pub platform: Option<String>,
2766+
2767+
#[arg(long, hide = true)]
2768+
pub python_version: Option<String>,
2769+
2770+
#[arg(long, hide = true)]
2771+
pub implementation: Option<String>,
2772+
2773+
#[arg(long, hide = true)]
2774+
pub abi: Option<String>,
2775+
}
2776+
27592777
#[derive(Args)]
27602778
pub struct BuildArgs {
27612779
/// The directory from which distributions should be built, or a source

crates/uv/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::str::FromStr;
1212
use std::sync::atomic::Ordering;
1313

1414
use anstream::eprintln;
15-
use anyhow::{Result, bail};
15+
use anyhow::{Result, anyhow, bail};
1616
use clap::error::{ContextKind, ContextValue};
1717
use clap::{CommandFactory, Parser};
1818
use futures::FutureExt;
@@ -1060,6 +1060,11 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
10601060
globals.preview,
10611061
)
10621062
}
1063+
Commands::Pip(PipNamespace {
1064+
command: PipCommand::Debug(_),
1065+
}) => Err(anyhow!(
1066+
"pip's `debug` is unsupported (consider using `uvx pip debug` instead)"
1067+
)),
10631068
Commands::Cache(CacheNamespace {
10641069
command: CacheCommand::Clean(args),
10651070
})

crates/uv/tests/it/common/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,14 @@ impl TestContext {
11041104
command
11051105
}
11061106

1107+
/// Create a `pip debug` command for testing.
1108+
pub fn pip_debug(&self) -> Command {
1109+
let mut command = Self::new_command();
1110+
command.arg("pip").arg("debug");
1111+
self.add_shared_options(&mut command, true);
1112+
command
1113+
}
1114+
11071115
/// Create a `uv help` command with options shared across scenarios.
11081116
#[allow(clippy::unused_self)]
11091117
pub fn help(&self) -> Command {

crates/uv/tests/it/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ mod pip_show;
7272
#[cfg(all(feature = "python", feature = "pypi"))]
7373
mod pip_sync;
7474

75+
mod pip_debug;
7576
mod pip_tree;
7677
mod pip_uninstall;
7778

crates/uv/tests/it/pip_debug.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use crate::common::{TestContext, uv_snapshot};
2+
3+
#[test]
4+
fn debug_warn() {
5+
let context = TestContext::new("3.12");
6+
7+
uv_snapshot!(context.pip_debug(), @r"
8+
success: false
9+
exit_code: 2
10+
----- stdout -----
11+
12+
----- stderr -----
13+
error: pip's `debug` is unsupported (consider using `uvx pip debug` instead)
14+
"
15+
);
16+
}

0 commit comments

Comments
 (0)