Skip to content

Add new Python 3.14 argparse.ArgumentParser constructor parameters #13947

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

Merged
merged 6 commits into from
May 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion stdlib/argparse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
fromfile_prefix_chars: str | None
add_help: bool
allow_abbrev: bool
exit_on_error: bool

if sys.version_info >= (3, 14):
suggest_on_error: bool
color: bool

# undocumented
_positionals: _ArgumentGroup
Expand Down Expand Up @@ -720,7 +725,33 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):

# Note: `add_parser` accepts all kwargs of `ArgumentParser.__init__`. It also
# accepts its own `help` and `aliases` kwargs.
if sys.version_info >= (3, 13):
if sys.version_info >= (3, 14):
def add_parser(
self,
name: str,
*,
deprecated: bool = False,
help: str | None = ...,
aliases: Sequence[str] = ...,
# Kwargs from ArgumentParser constructor
prog: str | None = ...,
usage: str | None = ...,
description: str | None = ...,
epilog: str | None = ...,
parents: Sequence[_ArgumentParserT] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = ...,
allow_abbrev: bool = ...,
exit_on_error: bool = ...,
suggest_on_error: bool = False,
color: bool = False,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes
) -> _ArgumentParserT: ...
elif sys.version_info >= (3, 13):
def add_parser(
self,
name: str,
Expand Down