Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/uv-dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ impl<'a> BuildContext for BuildDispatch<'a> {
build_kind: BuildKind,
) -> Result<SourceBuild> {
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 {
Expand Down
39 changes: 39 additions & 0 deletions crates/uv/tests/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();

// 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(&current_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.
Expand Down