Skip to content

Commit cecfabd

Browse files
committed
Fix pylock_no_binary to check settings even with --no-config
The --no-config flag only affects 'uv pip compile', not 'uv pip sync'. When a lock header contains --no-config, compile skips project settings but sync still reads and applies them. After a wire rewrite leaves only the patched wheel, sync fails with the same --no-binary error this change is meant to prevent. Remove the early return that skipped settings checks under --no-config, so we always verify that sync will accept the wheel.
1 parent a33ca5e commit cecfabd

3 files changed

Lines changed: 8 additions & 13 deletions

File tree

‎crates/socket-patch-core/src/patch/redirect/mod.rs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26365,6 +26365,8 @@ mod python_lock_warning_tests {
2636526365
),
2636626366
// `:none:` clears only the values before it.
2636726367
(" --no-binary :none: --no-binary six", &[]),
26368+
// `uv pip compile --no-config` skips settings, but sync still applies them.
26369+
(" --no-config", &[("uv.toml", "no-binary = true\n")]),
2636826370
];
2636926371
for (flags, extra) in refusals {
2637026372
let result = run(flags, extra);
@@ -26393,10 +26395,8 @@ mod python_lock_warning_tests {
2639326395
warning.detail
2639426396
);
2639526397
}
26396-
// Another package's flag or setting, no-build, a list turned off by
26397-
// no-binary = false, a uv.toml replacing pyproject's settings, and
26398-
// settings `uv pip compile --no-config` never read leave the wheel
26399-
// installable.
26398+
// Another package's flag or setting, no-build, or a list turned off by
26399+
// no-binary = false leave the wheel installable.
2640026400
let wired: &[(&str, &[(&str, &str)])] = &[
2640126401
("", &[]),
2640226402
(" --no-binary idna", &[]),
@@ -26419,7 +26419,6 @@ mod python_lock_warning_tests {
2641926419
),
2642026420
],
2642126421
),
26422-
(" --no-config", &[("uv.toml", "no-binary = true\n")]),
2642326422
(" --no-binary :all: --no-binary :none:", &[]),
2642426423
// The root's own settings stop the lookup above it.
2642526424
(

‎crates/socket-patch-core/src/patch/redirect/upstream/uv.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,9 +737,6 @@ pub(crate) fn pylock_no_binary(
737737
"the lock's `uv pip compile --no-binary` covers {name}, {consequence}"
738738
));
739739
}
740-
if command.contains(&"--no-config") {
741-
return None;
742-
}
743740
}
744741
let (path, key) = settings_no_binary(settings, &name)?;
745742
Some(format!(

‎crates/socket-patch-core/src/vendor/pypi_lock.rs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,6 +1789,8 @@ mod tests {
17891789
pyproject("[tool.uv]\nno-binary-package = [\"two\"]\n"),
17901790
)),
17911791
),
1792+
// `uv pip compile --no-config` skips settings, but sync still applies them.
1793+
(" --no-config", Some(("uv.toml", "no-binary = true\n"))),
17921794
] {
17931795
let Err(error) = load(pylock(flags), config).await else {
17941796
panic!("{flags:?} with {config:?} must refuse");
@@ -1797,10 +1799,8 @@ mod tests {
17971799
assert!(error.1.starts_with("pylock.toml: "), "{}", error.1);
17981800
assert!(error.1.contains("only from an sdist"), "{}", error.1);
17991801
}
1800-
// Another package's flag or setting, no-build, a list turned off by
1801-
// no-binary = false, a uv.toml that replaces pyproject's settings,
1802-
// and settings `uv pip compile --no-config` never read leave the
1803-
// wheel installable.
1802+
// Another package's flag or setting, no-build, or a list turned off by
1803+
// no-binary = false leave the wheel installable.
18041804
for (flags, config) in [
18051805
("", None),
18061806
(" --no-binary six", None),
@@ -1813,7 +1813,6 @@ mod tests {
18131813
"no-binary = false\nno-binary-package = [\"two\"]\n",
18141814
)),
18151815
),
1816-
(" --no-config", Some(("uv.toml", "no-binary = true\n"))),
18171816
(" --no-binary :all: --no-binary :none:", None),
18181817
] {
18191818
if let Err(error) = load(pylock(flags), config).await {

0 commit comments

Comments
 (0)