-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
gh-141679: Add colour to defaults in argparse help
#141680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-141679: Add colour to defaults in argparse help
#141680
Conversation
argparse helpargparse help
savannahostrowski
left a comment
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.
One comment about the two-color choice - I wonder if it might be a bit busy with the frequent color switching.
But overall, this looks really good and aligns with modern CLIs, IMO. I pretty extensively tested this and I couldn't find any issues. I also think it's fine to not apply color in help text when users might have literally written (default: ).
It would be useful to push these changes and then try to get as much feedback as possible before the 3.15 release. I agree that it does look a little too busy. I believe it would be good idea to make the Not sure if there was a follow up issue created from the "Open Issues" section of #133346 (specifically, clarifying how schema changes of a ThemeSection should be handled).
In [7]: from _colorize import get_theme
In [8]: t = get_theme().argparse
In [9]: t.action
Out[9]: '\x1b[1;32m'
In [10]: t.default
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[10], line 1
----> 1 t.default
AttributeError: 'Argparse' object has no attribute 'default'
In [11]: t.default_value
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[11], line 1
----> 1 t.default_value
AttributeError: 'Argparse' object has no attribute 'default_value' |
When time allows, I think @ambv is planning on a PEP for adding a |
argparsehelp #141679