fix(cli): preserve display output with --quiet - #14155
Open
ychampion wants to merge 4 commits into
Open
Conversation
Constraint: pip quiet mode uses logging thresholds that also suppress primary command output. Rejected: Emitting display output at warning level | it would misclassify normal output and route it through stderr. Confidence: high Scope-risk: moderate Directive: Keep install/download progress quiet-suppressible; opt in only primary display output. Tested: uv run --with pre-commit pre-commit run black --files <touched python files>; uv run --with pre-commit pre-commit run ruff-check --files <touched python files>; uv run --with nox nox -s test-3.12 -- <touched command test files> -q; uv run --with nox nox -s test-3.12 -- tests/functional/test_install.py::test_install_quiet -q; source-tree quiet-mode smoke checks for list/check/hash/cache/config/debug. Not-tested: Full pip suite across every supported Python version.
The quiet fallback writes primary display output directly when logging is too quiet. It should preserve the plain text shape of command output instead of letting Rich highlight package versions or paths under forced color.
Constraint: GitHub Actions sets FORCE_COLOR, exposing Rich highlighter output in quiet-mode fallback paths.\nRejected: Loosening the list test assertion | that would hide a real output-shape regression for plain display text.\nConfidence: high\nScope-risk: narrow\nDirective: Keep direct display fallback semantically plain unless a caller explicitly passes rich renderables.\nTested: PYTHONPATH=src FORCE_COLOR=1 python3 -m pip list --quiet | python3 -c 'import sys; data=sys.stdin.buffer.read(); print(b"\\x1b[" in data); print(data[:240].decode("utf-8", "replace"))'; uv run --with pre-commit pre-commit run black --files src/pip/_internal/utils/misc.py tests/functional/test_list.py; uv run --with pre-commit pre-commit run ruff-check --files src/pip/_internal/utils/misc.py tests/functional/test_list.py; uv run --with nox nox -s test-3.12 -- tests/functional/test_list.py::test_basic_list_quiet -q; uv run --with nox nox -s test-3.12 -- tests/functional/test_list.py tests/functional/test_show.py tests/functional/test_help.py tests/functional/test_index.py tests/functional/test_check.py tests/functional/test_hash.py tests/functional/test_cache.py tests/functional/test_configuration.py tests/functional/test_debug.py tests/unit/test_command_show.py -q; uv run --with nox nox -s test-3.12 -- tests/functional/test_install.py::test_install_quiet -q\nNot-tested: Full CI matrix locally.
sepehr-rs
suggested changes
Jul 8, 2026
sepehr-rs
left a comment
Member
There was a problem hiding this comment.
Hi @ychampion, thanks for your contribution!
I'm +1 on this overall. This is something I've wanted to tackle for a long time but never got around to.
The PR looks good overall, though I've left a few comments that I think would improve it further. Let me know if you have any questions!
Constraint: pip's quiet output fix should keep primary display output visible while preserving install and download quiet behavior. Rejected: Keeping per-command show_on_quiet=True annotations | maintainer requested making visible display output the default with explicit exceptions. Confidence: high Scope-risk: moderate Directive: Use show_on_quiet=False only for output that quiet mode should suppress. Tested: uv run --with pre-commit pre-commit run black --files src/pip/_internal/utils/misc.py src/pip/_internal/utils/logging.py src/pip/_internal/commands/show.py src/pip/_internal/commands/index.py src/pip/_internal/commands/check.py src/pip/_internal/commands/configuration.py src/pip/_internal/commands/cache.py src/pip/_internal/commands/list.py src/pip/_internal/commands/search.py src/pip/_internal/commands/hash.py src/pip/_internal/commands/debug.py src/pip/_internal/commands/download.py src/pip/_internal/commands/install.py tests/functional/test_cache.py; uv run --with pre-commit pre-commit run ruff-check --files same set; uv run --with nox nox -s test-3.12 -- tests/functional/test_show.py tests/functional/test_help.py tests/functional/test_index.py tests/functional/test_check.py tests/functional/test_list.py tests/functional/test_hash.py tests/functional/test_cache.py tests/functional/test_configuration.py tests/functional/test_debug.py tests/unit/test_command_show.py -q; uv run --with nox nox -s test-3.12 -- tests/functional/test_install.py::test_install_quiet -q; source-tree quiet smoke checks for list/show/cache/dry-run install. Not-tested: Full CI matrix locally.
sepehr-rs
suggested changes
Jul 8, 2026
sepehr-rs
left a comment
Member
There was a problem hiding this comment.
Thanks for addressing the review comments. I've left a couple more; let me know if you need any help with them.
Constraint: Address pip review comments without changing quiet-output behavior. Rejected: Keep the helper parameter | It only forwarded a constant default and made the call site harder to read. Confidence: high Scope-risk: narrow Directive: Keep quiet-mode bypass explicit at display-output write_output calls. Tested: uv run --with pre-commit pre-commit run black --files src/pip/_internal/commands/search.py src/pip/_internal/commands/show.py; uv run --with pre-commit pre-commit run ruff-check --files src/pip/_internal/commands/search.py src/pip/_internal/commands/show.py; uv run --with nox nox -s test-3.12 -- tests/functional/test_show.py tests/functional/test_help.py tests/functional/test_index.py tests/functional/test_check.py tests/functional/test_list.py tests/functional/test_hash.py tests/functional/test_cache.py tests/functional/test_configuration.py tests/functional/test_debug.py tests/unit/test_command_show.py -q; PYTHONPATH=src python3 -m pip show --quiet pip; PYTHONPATH=src python3 -m pip help --quiet; PYTHONPATH=src python3 -m pip cache dir --quiet; direct search helper smoke. Not-tested: Full CI matrix.
Member
|
Hey @notatallshaw, would you mind taking a look at this when you have a chance? You mentioned earlier that you'd be happy to review a PR for this issue if someone submitted one. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #13018.
--quietcurrently raises pip's logging threshold, which also hides primary output from display commands. This keeps primary display output visible when quiet mode suppressesINFOlogs, while leaving install/download progress output quiet-suppressible.Covered display paths include
show,help,index versions,list,check,hash,cache dir/info/list,config get/list/debug,debug, andsearchoutput.Validation:
uv run --with pre-commit pre-commit run black --files <touched Python files>uv run --with pre-commit pre-commit run ruff-check --files <touched Python files>uv run --with nox nox -s test-3.12 -- tests/functional/test_show.py tests/functional/test_help.py tests/functional/test_index.py tests/functional/test_check.py tests/functional/test_list.py tests/functional/test_hash.py tests/functional/test_cache.py tests/functional/test_configuration.py tests/functional/test_debug.py tests/unit/test_command_show.py -quv run --with nox nox -s test-3.12 -- tests/functional/test_install.py::test_install_quiet -qlist --quiet,show --quiet,cache dir --quiet, andinstall --dry-run --quietPR Checklist:
AI tools used: Codex.