fix: do not echo resolved requirements to stderr by default#2427
Open
MohammedAnasNathani wants to merge 3 commits into
Open
fix: do not echo resolved requirements to stderr by default#2427MohammedAnasNathani wants to merge 3 commits into
MohammedAnasNathani wants to merge 3 commits into
Conversation
When writing through --output-file, only mirror resolved lines to stderr at -v/--verbose or higher (log.debug). At default verbosity the output file is the sole destination for the result, which keeps stderr for progress/logging and avoids double-output confusion. Dry-run still always prints via log.log. Tests now assert compiled content from the output file where appropriate, plus a regression for jazzband#1987. Fixes jazzband#1987.
for more information, see https://pre-commit.ci
Assert exit_code after invoke so the result is used, matching other compile tests and clearing pre-commit.ci flake8 failures on jazzband#2427.
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.
Summary
When
pip-compilewrites through--output-file, it currently also mirrors every resolved requirement line to stderr at default verbosity (log.info). That makes verbose/progress output hard to separate from the lockfile body and matches the confusion reported in #1987.Decision (aligned with maintainer discussion on #2342 / #1987)
-v/--verbose(or higher): also echo those lines to stderr vialog.debugso the old “see the result while compiling” behavior is still available.log.log.Implementation is a one-line behavior change in
_FileLineWriter.__call__(log.info→log.debug), plus test updates so successful non-dry-run cases assert against the output file, and a dedicated regression test.Fixes #1987.
Motivation / use case
I hit this while compiling with
--output-fileand wanting clean stderr for progress/warnings only. Redirecting stdout/stderr was not enough because the lockfile body was duplicated on stderr at default verbosity.LLM use
I used an AI coding assistant to help draft the test updates and PR text. I reviewed the maintainer notes on #2342 (verbosity threshold should be
-v, not only-vv), implemented that threshold deliberately, and ran the localtests/test_cli_compile.pysuite (534 passed; 2 failures only from a local missingpipexecutable fortest_realistic_complex_sub_dependencies, unrelated to this change).Contributor checklist
changelog.d/(changelog.d/1987.bugfix.md).Maintainer checklist
bot:chronographer:skiplabel.(following Semantic Versioning).