Description
Feature or enhancement
In Python 3.13 we added colour output to the new REPL, traceback
and doctest
, and in 3.14 to unittest
, test.regrtest
and calendar
, that can also be controlled with the PYTHON_COLORS
, NO_COLOR
and FORCE_COLOR
environment variables:
- https://docs.python.org/3.14/whatsnew/3.14.html#unittest
- https://docs.python.org/3.14/using/cmdline.html#using-on-controlling-color
Let's add colour to argparse
help output.
Survey
First, here's a survey of some other CLIs that use colour:
These fall into four groups:
- uv/cargo: green + cyan
- composer: yellow + green
- ruff/lsd/fd/gh: only bold
- typer/rich-cli: green + cyan + yellow
Prototypes
I've made prototypes of two of these (uv/cargo style, typer/rich-cli style), and another with blue + magenta similar to the 3.13 REPL/traceback.
I think I prefer the typer/rich-cli style: the extra colour makes it easier to pick out the (green) short options from the (cyan) long options, and from their (green) arguments. And it should also be somewhat familiar to Python users who have used typer-based CLIs.
Linked PRs
Metadata
Metadata
Assignees
Projects
Status