Skip to content

Conversation

@savannahostrowski
Copy link
Member

@savannahostrowski savannahostrowski commented Oct 28, 2025

This PR fixes a visual inconsistency in the way that argparse displays error or warning messages with color enabled; the usage line and options are colorized, but the "error:" and "warning:" keywords remain as plain text. This change extends the existing colorization to be consistent across all outputs.

For example:

Before
image

After
image

@savannahostrowski savannahostrowski removed the needs backport to 3.14 bugs and security fixes label Oct 28, 2025
@savannahostrowski
Copy link
Member Author

@hugovk would love to get your thoughts here as well. Not sure if not colorizing error/warning keywords was an intentional choice when color was added, but I agree with the user in the issue; the current UX feels a little inconsistent.

That said, I could go either way on this. I have removed the backport label, since this is not eligible for backport (it's likely to be a breaking change for some folks).

@hugovk
Copy link
Member

hugovk commented Oct 28, 2025

It was intentional only as far as I didn't have time to include it for 3.14 and was hoping to do a followup for 3.15, so thank you!

PR looks good.

Bikeshedding the colour a little bit, what do you think doing something similar to traceback? Either same colours (bold magenta for error name, bold for error message), or same scheme (one colour for error name, another for message).

image

And something also for the warnings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants