Skip to content

gh-126071: Improve formatting of the argparse documentation #126073

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 2 commits into from
Oct 30, 2024

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Oct 28, 2024

  • Use appropriate roles for ArgumentParser, Action, etc.
  • Remove superfluous repeated links.
  • Explicitly document signatures and add index entries for some methods and classes.
  • Make it more clear that some parameters are keyword-only.
  • Fix some minor errors.

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

* Use appropriate roles for ArgumentParser, Action, etc.
* Remove superfluous repeated links.
* Explicitly document signatures and add index entries for some methods
  and classes.
* Make it more clear that some parameters are keyword-only.
* Fix some minor errors.
@rffontenelle
Copy link
Contributor

rffontenelle commented Oct 28, 2024

Just to mention that this PR successfully fixes an issue when extracting source messages for translation (using Sphinx's gettext builder) that was splitting descriptions into difference translation messages. Thanks!

How it looks before applying this fix:

#: ../../library/argparse.rst:1344
msgid "*parser* - The ArgumentParser object which contains this action."
msgstr ""

#: ../../library/argparse.rst:1346
msgid "*namespace* - The :class:`Namespace` object that will be returned by"
msgstr ""

#: ../../library/argparse.rst:1347
msgid ":meth:`~ArgumentParser.parse_args`.  Most actions add an attribute to this object using :func:`setattr`."
msgstr ""

#: ../../library/argparse.rst:1350
msgid "*values* - The associated command-line arguments, with any type conversions"
msgstr ""

#: ../../library/argparse.rst:1351
msgid "applied.  Type conversions are specified with the type_ keyword argument to :meth:`~ArgumentParser.add_argument`."
msgstr ""

Copy link
Member

@savannahostrowski savannahostrowski left a comment

Choose a reason for hiding this comment

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

Thanks for taking another pass at cleaning up the docs, Serhiy. This looks great.

Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

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

Thanks @serhiy-storchaka for the PR and @savannahostrowski for the review.

One small correction. Please feel free to merge @serhiy-storchaka. ☀️

@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) October 30, 2024 08:05
@serhiy-storchaka
Copy link
Member Author

Thank you @savannahostrowski and @willingc for your review.

@serhiy-storchaka serhiy-storchaka merged commit 2ab377a into python:main Oct 30, 2024
25 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 2ab377a47c8290f8bf52c8ffb5d7fc4c45452611 3.13

@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 2ab377a47c8290f8bf52c8ffb5d7fc4c45452611 3.12

@bedevere-app
Copy link

bedevere-app bot commented Oct 30, 2024

GH-126173 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 30, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Oct 30, 2024
…ion (pythonGH-126073)

* Use appropriate roles for ArgumentParser, Action, etc.
* Remove superfluous repeated links.
* Explicitly document signatures and add index entries for some methods
  and classes.
* Make it more clear that some parameters are keyword-only.
* Fix some minor errors.
(cherry picked from commit 2ab377a)

Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Oct 30, 2024
…ion (pythonGH-126073)

* Use appropriate roles for ArgumentParser, Action, etc.
* Remove superfluous repeated links.
* Explicitly document signatures and add index entries for some methods
  and classes.
* Make it more clear that some parameters are keyword-only.
* Fix some minor errors.
(cherry picked from commit 2ab377a)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Oct 30, 2024

GH-126174 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Oct 30, 2024
@serhiy-storchaka serhiy-storchaka removed their assignment Oct 30, 2024
serhiy-storchaka added a commit that referenced this pull request Oct 30, 2024
…H-126073) (GH-126174)

* Use appropriate roles for ArgumentParser, Action, etc.
* Remove superfluous repeated links.
* Explicitly document signatures and add index entries for some methods
  and classes.
* Make it more clear that some parameters are keyword-only.
* Fix some minor errors.
(cherry picked from commit 2ab377a)
serhiy-storchaka added a commit that referenced this pull request Oct 30, 2024
…H-126073) (GH-126173)

* Use appropriate roles for ArgumentParser, Action, etc.
* Remove superfluous repeated links.
* Explicitly document signatures and add index entries for some methods
  and classes.
* Make it more clear that some parameters are keyword-only.
* Fix some minor errors.
(cherry picked from commit 2ab377a)
picnixz pushed a commit to picnixz/cpython that referenced this pull request Dec 8, 2024
…thonGH-126073)

* Use appropriate roles for ArgumentParser, Action, etc.
* Remove superfluous repeated links.
* Explicitly document signatures and add index entries for some methods
  and classes.
* Make it more clear that some parameters are keyword-only.
* Fix some minor errors.
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
…thonGH-126073)

* Use appropriate roles for ArgumentParser, Action, etc.
* Remove superfluous repeated links.
* Explicitly document signatures and add index entries for some methods
  and classes.
* Make it more clear that some parameters are keyword-only.
* Fix some minor errors.
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
None yet
Development

Successfully merging this pull request may close these issues.

4 participants