fix(pm): stop passing --verbose to streamed uv runs

--verbose is uv's DEBUG level: every first-run bootstrap and sync printed
~200 lines of interpreter discovery, cache and reflink internals to the
user. Progress lines and build failures reach stderr without it.
This commit is contained in:
ethernet
2026-09-21 18:46:41 -04:00
parent 59f09c67b5
commit 2bdb7d338c
2 changed files with 19 additions and 2 deletions

View File

@@ -262,8 +262,9 @@ class PythonEnvironment:
command.append("--offline")
try:
if self.output is not None:
# uv hides build-backend output until failure without verbose mode.
command.append("--verbose")
# 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.
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)

View File

@@ -52,6 +52,22 @@ def test_pip_conf_is_bridged_only_when_uv_has_no_index(clean_index_env, monkeypa
assert "UV_INDEX_URL" not in env
def test_streamed_runs_do_not_request_uv_debug_output(tmp_path, monkeypatch):
import io
from pm import environment
seen: list[list[str]] = []
def record(command, **kwargs):
seen.append(command)
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])
def test_uv_timeout_names_the_mirror_knobs(tmp_path, monkeypatch):
def stall(*args, **kwargs):
raise subprocess.TimeoutExpired(args[0], kwargs["timeout"])