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
Copy link
Contributor Author

Krishna-web-hub commented Dec 11, 2025

Hi @savannahostrowski ,@picnixz I have made the requested changes; please review again.

@bedevere-app
Copy link

bedevere-app bot commented Dec 11, 2025

Thanks for making the requested changes!

@savannahostrowski, @picnixz: please review the changes made to this pull request.

@Krishna-web-hub
Copy link
Contributor Author

Hi @savannahostrowski , @picnixz i have done all the changes according to your message been waiting for any further changes.

@Krishna-web-hub
Copy link
Contributor Author

Apologies for the confusion
@savannahostrowski @picnixz.
​I realized that my local commits were not successfully pushed when I posted my last message. I have just pushed the correct changes now, and the checks have passed. The PR is ready for review again.

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.

There are still unrelated changes. Please avoid asking for a review if there is still things to change and address.

*aliases* argument,
which allows multiple strings to refer to the same subparser. This example,
like ``svn``, aliases ``co`` as a shorthand for ``checkout``::
.. 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.

Why do we have a duplicated entry here?

@bedevere-app
Copy link

bedevere-app bot commented Dec 28, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

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.

Copy link
Member

Choose a reason for hiding this comment

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

Please add back this documentation! We only want to document _SubParserAction.add_parser but we don't want to change other documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added the changes only having _SubParserAction.add_parser.

Copy link
Member

Choose a reason for hiding this comment

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

According to the diff, no. I don't see where the required parameter is documented. Please first fix the conflicts.

Copy link
Member

Choose a reason for hiding this comment

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

For instance where is this line? it's not here anymore.

@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.

Description of parameters:
.. method:: _SubParsersAction.add_parser(name, *, help=None, aliases=None, deprecated=False, **kwargs)

* *title* - title for the sub-parser group in help output; by default
Copy link
Member

Choose a reason for hiding this comment

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

The section "descriptions of parameters" is tied to ArgumentParser.add_subparsers. Yoiu are documenting _SubParsersAction.add_parser which is different. In other words, don't change the "Description of parameters" section.

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