Skip to content

Conversation

@Krishna-web-hub
Copy link
Contributor

@Krishna-web-hub Krishna-web-hub commented Oct 25, 2025

gh-84116: Doc: update the argparse documentation to clearly define the help and aliases parameters for add_parser() and added the required news file for this change.

Doc/library/argparse.rst

Replaced the vague, single-sentence description of _SubParsersAction.add_parser with a formal .. method:: directive.

This new directive explicitly lists help and aliases as parameters, along with descriptions of what they do.

Removed the old, redundant paragraphs about help (which was in parentheses) and aliases (which was a "Furthermore..." note) from later in the document. This centralizes all the information in one logical place.

Misc/NEWS.d/next/Library/...

Added the required "blurb" file to log this documentation fix.


📚 Documentation preview 📚: https://cpython-previews--140574.org.readthedocs.build/

@StanFromIreland StanFromIreland changed the title Doc fix 84116Docs: Document help and aliases for argparse.add_parser() (gh-84116) #84116 gh-84116: Docs: Document help and aliases for argparse.add_parser() Oct 25, 2025
Copy link
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seem to be two different things mixed in this PR, please split it.

Krishna-web-hub and others added 3 commits January 1, 2026 18:50
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please be more careful when you move text. You must keep all indications about "versionadded" etc, for each parameter so that users know when a feature was added. In addition, we are now missing the documentation for the general ArgumentParser.add_subparsers. Are you using an LLM for those changes? If so, please stop because this is wasting reviewer's time as there are useless and wrong changes.

In addition, please resolve the conflicts.

@picnixz
Copy link
Member

picnixz commented Jan 2, 2026

Before continuing working on this PR, please fix the conflicts.

@Krishna-web-hub
Copy link
Contributor Author

Hi @picnixz ,
Thanks for your valuable feedback. But the changes in the Sub-commands and sub-parser are told by the @savannahostrowski, mentioning #142488 , and also the anto was my mistake while doing some changes in the doc.

@picnixz
Copy link
Member

picnixz commented Jan 2, 2026

If some changes were mentioned in another PR, please merge main into this branch. You need to do it because there are conflicts. And those conflicts must be resolved before merging:

image

Once the diff is clean maybe some changes will be correct. But we are still lacking some description that are now gone and that must not be changed.

@Krishna-web-hub
Copy link
Contributor Author

Hi @picnixz , @savannahostrowski I have done the requested change please review it again.

@Krishna-web-hub
Copy link
Contributor Author

@picnixz , @savannahostrowski i want to know what i will be doing for the Sub-command please enlighten me such that i can do the final changes.

@picnixz
Copy link
Member

picnixz commented Jan 13, 2026

Keep your changes for that.

* *title* - title for the sub-parser group in help output; by default
"subcommands" if description is provided, otherwise uses title for
positional arguments
* *title* - title for the sub-parser group in help output; by default "subcommands" if description is provided, otherwise uses title for positional arguments
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I don't why you're trying to change this. Why are changing this part of the document? I feel my reviews are just being ignored.

Comment on lines +1889 to +1890
.. method:: _SubParsersAction.add_parser(name, *, help=None, aliases=None,
deprecated=False, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to aligned deprecated with name.

Comment on lines +1925 to +1926
.. versionadded:: 3.13
Added the *deprecated* parameter.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was meant to be added after "constructor.". And be careful with the number of blank lines. Don't just ask an LLM to make them. In fact, don't use LLMs for formatting.

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

Labels

awaiting changes docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

5 participants