Skip to content

gh-84116: Docs: Document help and aliases for argparse.add_parser()#140574

Merged
savannahostrowski merged 64 commits intopython:mainfrom
Krishna-web-hub:doc-fix-84116
Feb 6, 2026
Merged

gh-84116: Docs: Document help and aliases for argparse.add_parser()#140574
savannahostrowski merged 64 commits intopython:mainfrom
Krishna-web-hub:doc-fix-84116

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.

@picnixz
Copy link
Member

picnixz commented Jan 16, 2026

Please @picnixz , give me final instruction to fix this documentation issue

Next time, please be patient. I do not have enough time to review PRs especially when my feedback is not properly addressed.

Krishna-web-hub and others added 3 commits January 17, 2026 01:22
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@Krishna-web-hub
Copy link
Contributor Author

Krishna-web-hub commented Jan 16, 2026

Thanks @picnixz , for your effort for correcting me, for the mistake i am making. And i am very sorry for being impatient. I will keep it in my mind. And i was just being confused as it is sort of new for me, but i never want to disrespect you.

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.

Some final comments. Otherwise I think we can merge it.

Krishna-web-hub and others added 5 commits January 18, 2026 11:41
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>
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>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@Krishna-web-hub
Copy link
Contributor Author

@picnixz Added all the changes you have requested for.

>>> parser = argparse.ArgumentParser(prog='chicken.py')
>>> subparsers = parser.add_subparsers()
>>> fly = subparsers.add_parser('fly', deprecated=True)
>>> args = parser.parse_args(['fly']) # doctest: +SKIP
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove the doctest skip? and write down the exact output so that we also catch message regressions just in case? ty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @picnixz , Even after removing the # doctest: +SKIP the document does not produce the warning. so if you want i can remove the warning line below.

Copy link
Member

Choose a reason for hiding this comment

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

If the warning line is not emitted that is a bit weird. Is the warning emitted with the REPL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@picnixz i am able to produce the warning now
the warning goes by
chicken.py: warning: command 'fly' is deprecated
Namespace()
so i will be adding exactly the same or not.

Copy link
Member

@picnixz picnixz Feb 3, 2026

Choose a reason for hiding this comment

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

This has still not be changed. I want you to remove the skip and match the message correctly..

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 was just updating my branch here i have added the changes you requested.

@picnixz
Copy link
Member

picnixz commented Jan 19, 2026

(Btw the major changes I requested are addressed so this is in a mergeable state should I say).

@picnixz picnixz dismissed their stale review February 1, 2026 17:55

Changes were addressed.

@Krishna-web-hub
Copy link
Contributor Author

Hello @savannahostrowski the previous issue of two commit is being merged due to some issue in the branch and the documentation of free threading is merged in pr #140566. So if you please review the whole commit of this pr and tell me what else you need I can work according to it.

@Krishna-web-hub
Copy link
Contributor Author

Krishna-web-hub commented Feb 2, 2026

Hello @StanFromIreland The commits are already splited. please check out the changes done and tell me what else you need to be changed in the documentation

@savannahostrowski savannahostrowski merged commit 74db440 into python:main Feb 6, 2026
29 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Feb 6, 2026
@savannahostrowski
Copy link
Member

savannahostrowski commented Feb 6, 2026

Oops, I forgot to officially hit the approve button after reviewing this/before merging, that's my bad. I think we should close this one out and tackle any minor follow ups etc. in other PRs since this has been ongoing for quite awhile.

Thanks a lot for all the back and forth here @picnixz! Much appreciated.

@hugovk
Copy link
Member

hugovk commented Feb 6, 2026

Tip for next time, let's try and avoid listing all the cleanup commits in the squashed message, but keep the Co-authored-by trailers at the end:

74db440

(I use Refined GitHub which usually clears all that out.)

Thanks!

@savannahostrowski
Copy link
Member

Ah yeah, I forgot to do that too. I typically remember but I guess I'm just off my game today. Sorry!

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

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants