-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-42966: argparse: customizable help formatter #24377
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
base: main
Are you sure you want to change the base?
Conversation
Added public class CustomHelpFormat and private _CustomizableHelpFormatter to provide accessible API for basic help format customizations.
Fixed minor mistakes in documentation
Fixed doc indentation
Tests failed on macOS due to problems with ssl :( What now? |
Lib/argparse.py
Outdated
class CustomHelpFormat: | ||
"""Customizable help formatter factory.""" | ||
|
||
def __init__(self): |
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.
why not allow to pass the attributes by arguments ?
def __init__(self, *,
indent_increment: int = 2,
max_help_position: int = 24,
...
):
...
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 wanted to avoid backward incompatiblity when list of attributes change. On the other hand, this can be solved by adding **kwargs
at the end, so I think I'll try it this way.
Passing attributes to CustomHelpFormat constructor as keyword arguments
Fixed CustomHelpFormat constructor prototype in documentation
Fixed whitespace in docs
This PR is stale because it has been open for 30 days with no activity. |
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.
Ran 1692 tests in 3.109s
OK
Looks ok.
Added public CustomHelpFormat class and private _CustomizableHelpFormatter to provide accessible API for basic help format customizations.
This PR doesn't introduce any new formatting customization, just adds more accessible API for existing alternative help formatter classes and for changing basic HelpFormatter parameters (indentation), with possibility to extend it for future formatter classes.
https://bugs.python.org/issue42966