diff --git a/crates/uv-dispatch/src/lib.rs b/crates/uv-dispatch/src/lib.rs index e43d2253b..083a87416 100644 --- a/crates/uv-dispatch/src/lib.rs +++ b/crates/uv-dispatch/src/lib.rs @@ -280,7 +280,10 @@ impl<'a> BuildContext for BuildDispatch<'a> { build_kind: BuildKind, ) -> Result { match self.no_build { - NoBuild::All => bail!("Building source distributions is disabled"), + NoBuild::All => debug_assert!( + matches!(build_kind, BuildKind::Editable), + "Only editable builds are exempt from 'no build' checks" + ), NoBuild::None => {} NoBuild::Packages(packages) => { if let Some(dist) = dist { diff --git a/crates/uv/tests/pip_install.rs b/crates/uv/tests/pip_install.rs index fa1e2ca25..38b27ed15 100644 --- a/crates/uv/tests/pip_install.rs +++ b/crates/uv/tests/pip_install.rs @@ -696,6 +696,45 @@ fn install_editable_and_registry() -> Result<()> { Ok(()) } +#[test] +fn install_editable_no_binary() -> Result<()> { + let context = TestContext::new("3.12"); + + let current_dir = std::env::current_dir()?; + let workspace_dir = regex::escape( + Url::from_directory_path(current_dir.join("..").join("..").canonicalize()?) + .unwrap() + .as_str(), + ); + + let filters = [(workspace_dir.as_str(), "file://[WORKSPACE_DIR]/")] + .into_iter() + .chain(INSTA_FILTERS.to_vec()) + .collect::>(); + + // Install the editable package with no-binary enabled + uv_snapshot!(filters, command(&context) + .arg("-e") + .arg("../../scripts/editable-installs/black_editable") + .arg("--no-binary") + .arg(":all:") + .current_dir(¤t_dir) + .env("CARGO_TARGET_DIR", "../../../target/target_install_editable"), @r###" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + Built 1 editable in [TIME] + Resolved 1 package in [TIME] + Installed 1 package in [TIME] + + black==0.1.0 (from file://[WORKSPACE_DIR]/scripts/editable-installs/black_editable) + "### + ); + + Ok(()) +} + /// Install a source distribution that uses the `flit` build system, along with `flit` /// at the top-level, along with `--reinstall` to force a re-download after resolution, to ensure /// that the `flit` install and the source distribution build don't conflict.