You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
argparse: help parameter not documented in add_subparsers().add_parser #84116
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2020-03-11.16:25:58.045>labels= ['3.8', 'type-feature', '3.7', '3.9', 'docs']
title='argparse: help parameter not documented in add_subparsers().add_parser'updated_at=<Date2020-03-11.19:07:12.784>user='https://bugs.python.org/NazimeKoussailaLakehal'
The parameter help in the method add_parser of _SubParsersAction (that we obtain with ArgumentParser.add_subparsers()) Is not documented.
In the documentation we can find:
The add_subparsers() method is normally called with no arguments and returns a special action object. This object has a single method, add_parser(), which takes a command name and any ArgumentParser constructor arguments, and returns an ArgumentParser object that can be modified as usual.
I found the parameter by accident and then I checked in the source code, it's unfortunate because the help parameter give really nice output when having sub commands.
Hi @serhiy-storchaka ,
I'm happy to take this on! I will submit a PR to clearly document the help and aliases parameters for add_subparsers().add_parser() in the argparse documentation. I'll aim to have a PR ready soon.
Activity
NazimeKoussailaLakehal commentedon Mar 11, 2020
The parameter help in the method add_parser of _SubParsersAction (that we obtain with ArgumentParser.add_subparsers()) Is not documented.
In the documentation we can find:
The add_subparsers() method is normally called with no arguments and returns a special action object. This object has a single method, add_parser(), which takes a command name and any ArgumentParser constructor arguments, and returns an ArgumentParser object that can be modified as usual.
I found the parameter by accident and then I checked in the source code, it's unfortunate because the help parameter give really nice output when having sub commands.
the parameter 'aliases' is also not documented.
slateny commentedon Apr 25, 2022
A few paragraphs into the
add_subparsers()section, it says:(A help message for each subparser command, however, can be given by supplying the
help=argument toadd_parser()as above.)Then a few paragraphs further in, it says:
Furthermore,
add_parsersupports an additionalaliasesargument, which allows multiple strings to refer to the same subparser.So it seems that it's technically documented, but just not as well structured as say
add_subparsers()7 remaining items
Krishna-web-hub commentedon Oct 19, 2025
Hi @serhiy-storchaka ,
I'm happy to take this on! I will submit a PR to clearly document the help and aliases parameters for add_subparsers().add_parser() in the argparse documentation. I'll aim to have a PR ready soon.
serhiy-storchaka commentedon Oct 20, 2025
You are welcome, @Krishna-web-hub.
Docs: Document help and aliases for argparse.add_parser() (pythongh-8…
Docs: Document help and aliases for argparse.add_parser() (pythongh-8…
Docs: Document help and aliases for argparse.add_parser() (pythongh-8…
gh-84116: Docs: Document help and aliases for argparse.add_parser() (#…
gh-84116: Add missing backslash to `_SubParsersAction.add_parser` sig…
pythongh-84116: Docs: Document help and aliases for argparse.add_pars…
pythongh-84116: Add missing backslash to `_SubParsersAction.add_parse…
pythongh-84116: Docs: Document help and aliases for argparse.add_pars…
pythongh-84116: Add missing backslash to `_SubParsersAction.add_parse…