diff --git a/crates/uv-cli/src/compat.rs b/crates/uv-cli/src/compat.rs index 75b46a4e30920..b2d4e9b073087 100644 --- a/crates/uv-cli/src/compat.rs +++ b/crates/uv-cli/src/compat.rs @@ -136,7 +136,7 @@ impl CompatArgs for PipCompileCompatArgs { if self.emit_options { return Err(anyhow!( - "pip-compile's `--emit-options` is unsupported (uv never emits options)" + "pip-compile's `--emit-options` is unsupported (try `--emit-build-options` instead)" )); } diff --git a/crates/uv/tests/pip_compile/pip_compile.rs b/crates/uv/tests/pip_compile/pip_compile.rs index f342a8519a894..62f665ebedd30 100644 --- a/crates/uv/tests/pip_compile/pip_compile.rs +++ b/crates/uv/tests/pip_compile/pip_compile.rs @@ -6640,6 +6640,28 @@ fn resolver_legacy() -> Result<()> { Ok(()) } +/// Suggest the supported alternative when users pass `--emit-options` from `pip-compile`. +#[test] +fn emit_options_unsupported() -> Result<()> { + let context = uv_test::test_context!("3.12"); + let requirements_in = context.temp_dir.child("requirements.in"); + requirements_in.write_str("werkzeug==3.0.1")?; + + uv_snapshot!(context.filters(), context.pip_compile() + .arg("requirements.in") + .arg("--emit-options"), @" + success: false + exit_code: 2 + ----- stdout ----- + + ----- stderr ----- + error: pip-compile's `--emit-options` is unsupported (try `--emit-build-options` instead) + " + ); + + Ok(()) +} + /// Avoid including the `--index` and `-i` flags in the header. #[test] fn hide_index_urls() -> Result<()> {