Skip to content

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

Merged
savannahostrowski merged 64 commits into
python: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 into
python:mainfrom
Krishna-web-hub:doc-fix-84116

Conversation

@Krishna-web-hub

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

Copy link
Copy Markdown
Contributor

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/

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

@StanFromIrelandStanFromIreland left a comment

Copy link
Copy Markdown
Member

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

Krishna-web-hub commented Jan 16, 2026

Copy link
Copy Markdown
ContributorAuthor

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.

@picnixzpicnixz left a comment

Copy link
Copy Markdown
Member

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.

Comment threadDoc/library/argparse.rst Outdated
Comment threadDoc/library/argparse.rst Outdated
Comment threadDoc/library/argparse.rst Outdated
Comment threadDoc/library/argparse.rst Outdated
Comment threadDoc/library/argparse.rst Outdated
Krishna-web-huband 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
Copy Markdown
ContributorAuthor

@picnixz Added all the changes you have requested for.

Comment threadDoc/library/argparse.rst
Comment threadDoc/library/argparse.rst Outdated
>>> 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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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.

@picnixzpicnixzFeb 3, 2026

Copy link
Copy Markdown
Member

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

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

@picnixz
picnixz dismissed their stale reviewFebruary 1, 2026 17:55

Changes were addressed.

@Krishna-web-hub

Copy link
Copy Markdown
ContributorAuthor

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

Krishna-web-hub commented Feb 2, 2026

Copy link
Copy Markdown
ContributorAuthor

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:mainFeb 6, 2026
29 checks passed
@github-project-automationgithub-project-automationBot moved this from Todo to Done in Docs PRsFeb 6, 2026
@savannahostrowski

savannahostrowski commented Feb 6, 2026

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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
Copy Markdown
Member

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

the main parser.


.. method:: _SubParsersAction.add_parser(name, *, help=None, aliases=None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing backslash, fixed at #144572.

@Krishna-web-hub
Krishna-web-hub deleted the doc-fix-84116 branch February 7, 2026 19:04
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
…er() (python#140574)
* pythongh-140281: Doc: Update free-threading how-to
* pythongh-140281: Doc: Update free-threading how-to
* Fix trailing whitespace
* doc fixing of the cpython fixes#84116
* Docs: Document help and aliases for argparse.add_parser() (pythongh-84116)
* Docs: Document help and aliases for argparse.add_parser() (pythongh-84116)
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing errors
* Fix trailing errors and spaces
* Fix docutils formatting, NEWS ref, and trailing whitespace
* Docs: Update argparse.rst and add NEWS entry
* Delete Doc/howto/free-threading-python.rst
* Delete Misc/NEWS.d/next/Documentation/2025-10-25-00-49-43.gh-issue-140281.tuMQUe.rst
* adding the depreceated tag
* The error indexing was fixed
* Fix trailing whitespace
* Restore missing free-threading documentation
* fixing some minor error
* fixing some minor error part 2
* fixing some minor error part 3
* Fix NEWS entry format
* Final cleanup of NEWS entry format 2
* changes in the argparse.rst
* Remove unnecessary NEWS entry
* Fixing the issue as requested
* Added the Changes done before.
* done the changes
* done the changes#1
* Apply suggestion from @picnixz
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Apply suggestion from @picnixz
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Done the changes
* Done the new changes
* The versionadded is rectified
* Update Doc/library/argparse.rst
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
* Docs editing
* Docs fixing whitespace
* Docs rectifiying
* little bit rectification
* Indentation rectification
* Indentation rectification 1
* Apply suggestion from @picnixz
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* deprecated rectification
* Remove mistakenly added NEWS entry
* Update Doc/library/argparse.rst
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* changes python#1
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Update Doc/library/argparse.rst 2
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* removed useless thing
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* changed according to the request
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Updated the test part
---------
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
…er() (python#140574)
* pythongh-140281: Doc: Update free-threading how-to
* pythongh-140281: Doc: Update free-threading how-to
* Fix trailing whitespace
* doc fixing of the cpython fixes#84116
* Docs: Document help and aliases for argparse.add_parser() (pythongh-84116)
* Docs: Document help and aliases for argparse.add_parser() (pythongh-84116)
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing whitespace
* Fix trailing errors
* Fix trailing errors and spaces
* Fix docutils formatting, NEWS ref, and trailing whitespace
* Docs: Update argparse.rst and add NEWS entry
* Delete Doc/howto/free-threading-python.rst
* Delete Misc/NEWS.d/next/Documentation/2025-10-25-00-49-43.gh-issue-140281.tuMQUe.rst
* adding the depreceated tag
* The error indexing was fixed
* Fix trailing whitespace
* Restore missing free-threading documentation
* fixing some minor error
* fixing some minor error part 2
* fixing some minor error part 3
* Fix NEWS entry format
* Final cleanup of NEWS entry format 2
* changes in the argparse.rst
* Remove unnecessary NEWS entry
* Fixing the issue as requested
* Added the Changes done before.
* done the changes
* done the changes#1
* Apply suggestion from @picnixz
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Apply suggestion from @picnixz
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Done the changes
* Done the new changes
* The versionadded is rectified
* Update Doc/library/argparse.rst
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
* Docs editing
* Docs fixing whitespace
* Docs rectifiying
* little bit rectification
* Indentation rectification
* Indentation rectification 1
* Apply suggestion from @picnixz
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* deprecated rectification
* Remove mistakenly added NEWS entry
* Update Doc/library/argparse.rst
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* changes python#1
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Update Doc/library/argparse.rst 2
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* removed useless thing
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* changed according to the request
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Updated the test part
---------
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docsDocumentation in the Doc dirskip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants

@Krishna-web-hub@picnixz@savannahostrowski@hugovk@guoci@StanFromIreland@dreadstache@nazeerali4325-commits