Description
What's the problem this feature will solve?
pip 22 now uses Rich for installation progress bars and some error handling, which gives us pretty colours!
Colour can help diagnose problems, and a common place for pip and the need to diagnose problems is on a CI.
However, because the GitHub Actions isn't a tty, output of tools which autodetect the terminal output is usually monochrome. That's why many tools and CI setups use the FORCE_COLOR
environment variable, and/or command-line options to turn it back on.
The pip CI included (#10830):
Lines 14 to 17 in 4a508c2
However, pip itself (and Rich) don't use FORCE_COLOR
, meaning we get monochrome output:
Compare with nox:
https://github.com/pypa/pip/runs/5177210581?check_suite_focus=true
And pytest:
https://github.com/pytest-dev/pytest/runs/5185781927?check_suite_focus=true
Describe the solution you'd like
Enable colour when FORCE_COLOR
is set.
For reference:
Alternative Solutions
Get Rich to support FORCE_COLOR
directly. This was considered in 2020 but rejected in Textualize/rich#343 to leave it up to the developer to support it.
But Will said "I may yet relent on this. I try to be pragmatic!" so it may still be a better option :)
Additional context
I'm not specifically requesting it here, but could be worth considering also disabling when NO_COLOR
is set: https://no-color.org/
Similarly not requesting it here, but for completeness I'll mention pytest also has this command-line option:
--color=color color terminal output (yes/no/auto).
And nox:
--nocolor, --no-color
Disable all color output.
--forcecolor, --force-color
Force color output, even if stdout is not an interactive terminal.
Whereas pip only has the negative:
--no-color Suppress colored output.
Code of Conduct
- I agree to follow the PSF Code of Conduct.