GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-130645: Default to color help in argparse by pablogsal · Pull Request #136809 · python/cpython

Conversation

@pablogsal

@pablogsal pablogsal commented Jul 19, 2025 •
edited by StanFromIreland
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Colored help significantly improves readability and user experience by helping users visually group and separate different sections, options, and arguments. Modern terminals overwhelmingly support ANSI color codes, and most contemporary programming languages and CLI tools now default to colored output when appropriate.

This change aligns Python's argparse with current standards where color is the expected default behavior. Users find colored output particularly valuable for quickly scanning and understanding command-line help, as it creates natural visual hierarchy and reduces cognitive load when parsing complex option lists.

The existing color detection logic already gracefully falls back to plain text on unsupported terminals, ensuring backwards compatibility. Users who prefer monochrome output retain full control through standard terminal preferences and environment variables.

  • Issue: Add colour to argparse help #130645

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski and hartwork reacted with heart emoji
All reactions
  • ❤️ 2 reactions
@pablogsal
Default to color help in argparse
5c4080a
@pablogsal
pablogsal requested a review from savannahostrowski as a code owner July 19, 2025 12:44
@bedevere-app bedevere-app Bot added the awaiting core review label Jul 19, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Jul 19, 2025
Add colour to argparse help #130645
Closed
@StanFromIreland
StanFromIreland requested a review from hugovk July 19, 2025 12:47
StanFromIreland
StanFromIreland approved these changes Jul 19, 2025
View reviewed changes

@StanFromIreland StanFromIreland left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM, I like these:-)

Requested color expert. I think this can be skip-news since there is no change to the content? I see there was a NEWS entry for the previous PR, it was general enough that we could put it under it if that is possible?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
hugovk added 3 commits July 19, 2025 16:09
@hugovk
Default to color help in argparse
f93920d
@hugovk
Update docs
b1ef640
@hugovk
Update tests
dddcd65
@hugovk
hugovk requested a review from erlend-aasland as a code owner July 19, 2025 14:47
ambv
ambv reviewed Jul 19, 2025
View reviewed changes
Comment thread Doc/library/argparse.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

ambv
ambv approved these changes Jul 19, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Jul 19, 2025
@hugovk @ambv
Fix wording
b5c0d88
Co-authored-by: Łukasz Langa <[email protected]>
@pablogsal
pablogsal requested review from 1st1, ambv and vstinner July 19, 2025 15:21
ambv
ambv approved these changes Jul 19, 2025
View reviewed changes

@ambv ambv left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I can approve again if you really want me to.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AA-Turner
Improve description of disabling colour support locally vs in the Arg…
82c7e25
…umentParser
AA-Turner
AA-Turner approved these changes Jul 19, 2025
View reviewed changes

@AA-Turner AA-Turner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The rationale makes sense. My only concern would be cmd.exe on Windows, where I've had bad experiences with ANSI codes before, but local testing demonstrates that things seem to be working.

A

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AA-Turner
Add a cross-reference to NEWS
0abf68e
@hugovk hugovk added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 20, 2025
@bedevere-bot

bedevere-bot commented Jul 20, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @hugovk for commit 0abf68e 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F136809%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 20, 2025
savannahostrowski
savannahostrowski approved these changes Jul 20, 2025
View reviewed changes

@savannahostrowski savannahostrowski left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Man, this looks so good! Thanks for making the PR. Just one small comment re. docs!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/argparse.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner AA-Turner added the sprint label Jul 20, 2025
hugovk
hugovk approved these changes Jul 20, 2025
View reviewed changes
@savannahostrowski

savannahostrowski commented Jul 20, 2025

Copy link
Copy Markdown
Member

We've gotten a lot of approvals on this PR 😃 and I intend to merge it imminently. @hugovk We're good to get this into 3.14, yeah? If so, I'll add the backport to 3.14 label before merge.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk

hugovk commented Jul 20, 2025

Copy link
Copy Markdown
Member

Yes, good to backport to 3.14.

savannahostrowski reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner AA-Turner added the needs backport to 3.14 bugs and security fixes label Jul 20, 2025
@savannahostrowski
savannahostrowski merged commit acbe896 into python:main Jul 20, 2025
@miss-islington-app

miss-islington-app Bot commented Jul 20, 2025

Copy link
Copy Markdown

Thanks @pablogsal for the PR, and @savannahostrowski for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Jul 20, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 20, 2025
@pablogsal @hugovk
@ambv @AA-Turner @miss-islington
pythonGH-130645: Default to color help in argparse (pythonGH-136809)
0db8c61
(cherry picked from commit acbe896)

Co-authored-by: Pablo Galindo Salgado <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@bedevere-app

bedevere-app Bot commented Jul 20, 2025

Copy link
Copy Markdown

GH-136886 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 20, 2025
savannahostrowski pushed a commit that referenced this pull request Jul 20, 2025
@miss-islington @pablogsal
@hugovk @ambv @AA-Turner
[3.14] GH-130645: Default to color help in argparse (GH-136809) (#136886
17c5959
)

GH-130645: Default to color help in argparse (GH-136809)
(cherry picked from commit acbe896)

Co-authored-by: Pablo Galindo Salgado <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@tgbrooks

tgbrooks commented Jul 23, 2025

Copy link
Copy Markdown

It seemed like the previous discussion at #130645 had the consensus of having this opt-in. I'm surprised to see this made opt-out now. For example, @savannahostrowski previously stated "I'm +1 on this, if it's opt-in" but appears to approve of this change. Other commenters from the previous thread that were also in support of making it opt-in include @rhettinger and @sobolevn but haven't commented on this issue. Concerns mentioned included start-up time and breaking of tests. No one in the previous issue made an argument for doing opt-out. It seems to me that making it opt-out is perhaps premature. Was this discussed somewhere else that I've missed? Thanks.

Apologies if this isn't the right place to raise this, I'm not a contributor, I just saw the 3.14rc1 release and noticed this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@savannahostrowski

savannahostrowski commented Jul 23, 2025

Copy link
Copy Markdown
Member

@tgbrooks Yeah, I thought about this more, and I think the risk here is very low. @hugovk did a lot of due diligence around testing performance impact, making it respect NO_COLOR, etc., so my concerns were addressed. As Pablo also mentioned, color aligns with current standards and expectations, so I think this is a great addition.

hugovk reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@pablogsal @hugovk
@ambv @AA-Turner @taegyunkim
pythonGH-130645: Default to color help in argparse (python#136809)
7373ba2
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@neutrinoceros neutrinoceros mentioned this pull request Aug 15, 2025
CLN: simplify argument parser settings astropy/astropy#18520
Merged
1 task
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@pablogsal @hugovk
@ambv @AA-Turner @Agent-Hellboy
pythonGH-130645: Default to color help in argparse (python#136809)
e129bcb
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@cdce8p cdce8p mentioned this pull request Aug 24, 2025
Revert "Enable colored output for argparse help in Python 3.14 (#19021)" python/mypy#19721
Merged
ilevkivskyi pushed a commit to python/mypy that referenced this pull request Aug 25, 2025
@cdce8p
Revert "Enable colored output for argparse help in Python 3.14 (#19021)…
881a35a
…" (#19721)

Reverts #19021

After the PR was merged, `color` was changed to `true` for Python 3.14.
Setting it manually is no longer necessary.
python/cpython#136809
https://docs.python.org/3.14/library/argparse.html#color
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
@miss-islington @pablogsal
@hugovk @ambv @AA-Turner @kumaraditya303
[3.14] pythonGH-130645: Default to color help in argparse (pythonGH-1…
cb8d6b3
…36809) (python#136886)

pythonGH-130645: Default to color help in argparse (pythonGH-136809)
(cherry picked from commit acbe896)

Co-authored-by: Pablo Galindo Salgado <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
This was referenced Oct 12, 2025
Add missing @force_not_colorized_test_class decorator to TestOptionalHelpVersionActions #139979
Closed
GH-139979: Add @force_not_colorized_test_class to TestOptionalHelpVersionActions #139980
Merged
@jacobtylerwalls jacobtylerwalls mentioned this pull request Dec 19, 2025
Fixed #36376 -- Fixed color suppression in argparse help on Python 3.14+. django/django#20422
Merged
5 of 6 tasks
jacobtylerwalls pushed a commit to Skyiesac/django that referenced this pull request Dec 22, 2025
@Skyiesac @jacobtylerwalls
Fixed #36376 -- Fixed --no-color for command help in Python 3.14+.
6910154
python/cpython#136809 made `color` default to
True in ArgumentParser.
jacobtylerwalls pushed a commit to django/django that referenced this pull request Dec 22, 2025
@Skyiesac @jacobtylerwalls
Fixed #36376 -- Fixed --no-color for command help in Python 3.14+.
d0d85cd
python/cpython#136809 made `color` default to
True in ArgumentParser.
jacobtylerwalls pushed a commit to django/django that referenced this pull request Dec 22, 2025
@Skyiesac @jacobtylerwalls
[6.0.x] Fixed #36376 -- Fixed --no-color for command help in Python 3…
b0befe1
….14+.

python/cpython#136809 made `color` default to
True in ArgumentParser.

Backport of d0d85cd from main.
jacobtylerwalls pushed a commit to django/django that referenced this pull request Dec 22, 2025
@Skyiesac @jacobtylerwalls
[5.2.x] Fixed #36376 -- Fixed --no-color for command help in Python 3…
8346657
….14+.

python/cpython#136809 made `color` default to
True in ArgumentParser.

Backport of d0d85cd from main.
yshng pushed a commit to OpenTechStrategies/django that referenced this pull request May 17, 2026
@Skyiesac Lily Ye
[5.2.x] Fixed #36376 -- Fixed --no-color for command help in Python 3…
0a217cc
….14+.

python/cpython#136809 made `color` default to
True in ArgumentParser.

Backport of d0d85cd from main.
JordanHyatt pushed a commit to JordanHyatt/django that referenced this pull request May 18, 2026
@Skyiesac jordan
Fixed #36376 -- Fixed --no-color for command help in Python 3.14+.
35c7643
python/cpython#136809 made `color` default to
True in ArgumentParser.
MarkoM-dot pushed a commit to MarkoM-dot/django that referenced this pull request Aug 28, 2026
@Skyiesac @MarkoM-dot
Fixed #36376 -- Fixed --no-color for command help in Python 3.14+.
de6c4ec
python/cpython#136809 made `color` default to
True in ArgumentParser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@savannahostrowski savannahostrowski savannahostrowski approved these changes
@AA-Turner AA-Turner AA-Turner approved these changes
@ambv ambv ambv approved these changes
@hugovk hugovk hugovk approved these changes
@StanFromIreland StanFromIreland StanFromIreland approved these changes
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@vstinner vstinner Awaiting requested review from vstinner
@1st1 1st1 Awaiting requested review from 1st1

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

sprint

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@pablogsal @bedevere-bot @savannahostrowski @hugovk @tgbrooks @ambv @AA-Turner @StanFromIreland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.