Skip to content

fix: do not echo resolved requirements to stderr by default#2427

Open
MohammedAnasNathani wants to merge 3 commits into
jazzband:mainfrom
MohammedAnasNathani:fix/verbose-file-output-no-dump
Open

fix: do not echo resolved requirements to stderr by default#2427
MohammedAnasNathani wants to merge 3 commits into
jazzband:mainfrom
MohammedAnasNathani:fix/verbose-file-output-no-dump

Conversation

@MohammedAnasNathani

Copy link
Copy Markdown

Summary

When pip-compile writes 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)

  • Default verbosity: write resolved lines only to the output file.
  • -v / --verbose (or higher): also echo those lines to stderr via log.debug so the old “see the result while compiling” behavior is still available.
  • Dry-run: unchanged — still always prints the result via log.log.

Implementation is a one-line behavior change in _FileLineWriter.__call__ (log.infolog.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-file and 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 local tests/test_cli_compile.py suite (534 passed; 2 failures only from a local missing pip executable for test_realistic_complex_sub_dependencies, unrelated to this change).

Contributor checklist
  • Included tests for the changes.
  • A change note is created in changelog.d/ (changelog.d/1987.bugfix.md).
Maintainer checklist
  • If no changelog is needed, apply the bot:chronographer:skip label.
  • Assign the PR to an existing or new milestone for the target version
    (following Semantic Versioning).

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.
Copilot AI review requested due to automatic review settings July 23, 2026 12:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided A mark meaning that a new change log entry is present within the patch. label Jul 23, 2026
pre-commit-ci Bot and others added 2 commits July 23, 2026 12:11
Assert exit_code after invoke so the result is used, matching other
compile tests and clearing pre-commit.ci flake8 failures on jazzband#2427.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided A mark meaning that a new change log entry is present within the patch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verbose output without final result when outputting to a file

2 participants