From fdf9cebe2cf2f11bf7feb96b5b244f1615e0138d Mon Sep 17 00:00:00 2001 From: ethernet Date: Mon, 21 Sep 2026 18:48:58 -0400 Subject: [PATCH] fix(pm): keep streamed build-backend output without uv's DEBUG spew The previous commit dropped --verbose and broke the contract that native build output streams live (tests/pm/test_environment_build.py). uv only forwards backend output at DEBUG level, so keep --verbose and scope it with RUST_LOG=uv_build_frontend=debug: the backend's own lines stream, the interpreter/cache/reflink internals stay silent (2 lines on a no-op sync instead of ~200 on both uv 0.11 and the pinned 0.12.3). --- pm/environment.py | 9 ++++++--- tests/pm/test_index_bridging.py | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pm/environment.py b/pm/environment.py index 3c4c63840a..fa8e17aa07 100644 --- a/pm/environment.py +++ b/pm/environment.py @@ -262,9 +262,12 @@ class PythonEnvironment: command.append("--offline") try: if self.output is not None: - # No --verbose: it is uv's DEBUG level and buries the progress - # lines under interpreter/cache internals on every streamed run. - # Build-backend output still arrives with the failure. + # uv hides build-backend output until failure without verbose mode, + # but --verbose alone is uv's DEBUG level: ~200 lines of interpreter + # and cache internals on every streamed run. RUST_LOG scopes it to the + # build frontend, so only the backend's own lines reach the user. + command.append("--verbose") + env.setdefault("RUST_LOG", "uv_build_frontend=debug") return _run_streaming(command, cwd=cwd, env=env, timeout=timeout, output=self.output) return subprocess.run(command, cwd=str(cwd), env=env, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=timeout) diff --git a/tests/pm/test_index_bridging.py b/tests/pm/test_index_bridging.py index e854602a78..5983ede607 100644 --- a/tests/pm/test_index_bridging.py +++ b/tests/pm/test_index_bridging.py @@ -57,15 +57,19 @@ def test_streamed_runs_do_not_request_uv_debug_output(tmp_path, monkeypatch): from pm import environment seen: list[list[str]] = [] + kwargs_seen: list[dict] = [] def record(command, **kwargs): seen.append(command) + kwargs_seen.append(kwargs) return subprocess.CompletedProcess(command, 0, "", "") monkeypatch.setattr(environment, "_run_streaming", record) PythonEnvironment(uv=tmp_path / "uv", python=tmp_path / "python", destination=tmp_path / "venv", cache=tmp_path / "cache", env={}, output=io.StringIO())._run(["sync"], cwd=tmp_path, timeout=5) - assert seen and not {"--verbose", "-v"} & set(seen[0]) + (command,), (kwargs,) = seen, kwargs_seen + # Verbose only where the build backend speaks; uv's own DEBUG stays silent. + assert "--verbose" in command and kwargs["env"]["RUST_LOG"] == "uv_build_frontend=debug" def test_uv_timeout_names_the_mirror_knobs(tmp_path, monkeypatch):