Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add colour toargparse help #130645

Closed
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement
@hugovk

Description

@hugovk

Feature or enhancement

In Python 3.13 we added colour output to the new REPL,traceback anddoctest, and in 3.14 tounittest,test.regrtest andcalendar, that can also be controlled with thePYTHON_COLORS,NO_COLOR andFORCE_COLOR environment variables:

Let's add colour toargparse help output.

Survey

First, here's a survey of some other CLIs that use colour:

Survey
uv
ImageImage
cargo
ImageImage
composer
ImageImage
ruff
ImageImage
lsd
ImageImage
fd
ImageImage

See also: bat, hyperfine, oxipng, zizmor

gh
ImageImage
rich-cli
ImageImage
typer
ImageImage

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.

Prototypes
main
ImageImage
uv/cargo style
ImageImage
typer/rich-cli style
ImageImage
REPL style
ImageImage

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

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Status

    Doc issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp