Pip upgrade prompt is not sent to stderr anymore 路 Issue #11282 路 pypa/pip (original) (raw)

Description

Hello there! 馃憢

This is my first bug report to pip 馃槂 I've written Python for more than 10 years and it's always been a pleasure to install packages with pip. We, at Mozilla, use Python intensively for our CI/CD and pip is the cornerstone of our package management. Today, we ran into an issue that blocked our entire CI/CD. We parse the output of pip freeze and today, some lines couldn't be parsed. These were lines about a pip upgrade.

After looking into the pip code, we realized this fairly recent PR #10959 changed the formatting of the upgrade prompt, but also it now redirects the prompt to stdout instead of stderr. Based on the patch, I get the feeling this is unexpected behavior.

There's been 4 releases since this PR got merged. There are 2 reasons why we just noticed it today:

  1. I upgraded pip in our infra from 21.1.3 to 22.1.2, 12 days ago
  2. 22.2 got released 3 hours ago.

Shoutout to @jcristau who was instrumental in narrowing down the bug to #10959

Expected behavior

For the sake of remaining parseable, I believe the upgrade prompt should remain in stderr. I'm happy to discuss this though 馃檪

pip version

21.1

Python version

N/A

OS

N/A

How to Reproduce

Steps to reproduce:

  1. VERSION='22.0.4'; pip install "$VERSION" && pip list --format freeze > "$VERSION".stdout.txt 2> "$VERSION".stderr.txt
  2. Change the version number to 22.1.2 and rerun the same command
  3. head *.txt

See the output below: it shows there's nothing anymore in stderr and the prompt got moved to stdout.

Output

==> 22.0.4.stderr.txt <== WARNING: You are using pip version 22.0.4; however, version 22.2 is available. You should consider upgrading via the '/private/tmp/pip/.env/bin/python -m pip install --upgrade pip' command.

==> 22.0.4.stdout.txt <== pip==22.0.4 setuptools==62.6.0 wheel==0.37.1

==> 22.1.2.stderr.txt <==

==> 22.1.2.stdout.txt <== pip==22.1.2 setuptools==62.6.0 wheel==0.37.1

[notice] A new release of pip available: 22.1.2 -> 22.2 [notice] To update, run: pip install --upgrade pip

Code of Conduct