Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-124478: Cleanup argparse documentation#124877

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JelleZijlstra merged 24 commits intopython:mainfromsavannahostrowski:gh-124478
Oct 8, 2024

Conversation

@savannahostrowski
Copy link
Member

@savannahostrowskisavannahostrowski commentedOct 2, 2024
edited
Loading

This PR:

  1. Removes duplicative examples that are fairly basic and sufficiently covered in the tutorial
  2. Removes the quick reference tables, as removing duplicative examples moves the reference docs forArgumentParser andadd_argument much higher up the page. I don't think this is terribly necessary anymore.
  3. Move the upgrading to optparse guide to a separate page. Since optparse has been deprecated since 3.2, this is probably a minimally viewed part of the main argparse docs, so I think it's fair to have it on a separate page.
  4. Consolidates some examples
  5. Updates terminology (e.g., sub-command -> subcommand) for consistency.

Please let me know if there are other best practices we consistently use in other documentation areas but lack here. I'm happy to incorporate them here so we can get these documents feeling fresh!

(As a note, I tried to be somewhat conservative here as I do think many of the examples are 1) valuable for new users and 2) too advanced to add to the tutorial in its current form)

@bedevere-appbedevere-appbot added docsDocumentation in the Doc dir skip news awaiting review labelsOct 2, 2024
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@JelleZijlstra
Copy link
Member

I looked at the previewhttps://cpython-previews--124877.org.readthedocs.build/en/124877/library/argparse.html#module-argparse and skimmed the entire doc. Below are some things I noticed. None are new to this PR, so feel free to ignore them and I can file a separate PR with those cleanups.

  • It's distracting that the first few paragraphs link:mod:`argparse` 4 times, and it just links back to the top of the page. Would recommend suppressing those links with:mod:`!argparse`.
  • RawTextHelpFormatter description says "new lines"; I think it's normally spelled "newlines".
  • "ArgumentParser usesfilesystem encoding and error handler to read the file containing arguments." this sentence reads oddly, maybe needs a "the"
  • "the action default will not over write it" -> I think "overwrite" is one word
  • I might remove theparser.add_argument('source_file', type=open) example. It doesn't make it easy to properly close the file, and as the text says later, FileNotFoundError would not be handled nicely.
  • FileType is formatted inconsistently in the paragraph that startsEven [FileType](https://cpython-previews--124877.org.readthedocs.build/en/124877/library/argparse.html#argparse.FileType) has its limitations for use with the type keyword.
  • The text after "class argparse.Action" should be indented by another level.
  • The docs forparse_known_intermixed_args are not properly indented.

@savannahostrowski
Copy link
MemberAuthor

Thanks so much for such a thorough review,@JelleZijlstra. I think I can incorporate your feedback in this PR. I'll revisit this tomorrow evening.

JelleZijlstra reacted with thumbs up emoji

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Copy link
Contributor

@willingcwillingc left a comment

Choose a reason for hiding this comment

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

Lovely work@savannahostrowski. Thank you!

savannahostrowski reacted with heart emoji
@savannahostrowski
Copy link
MemberAuthor

@JelleZijlstra, I applied all of your suggestions. I also found formatting inconsistencies in taking another pass related to indentation and style.

@JelleZijlstraJelleZijlstra added needs backport to 3.12only security fixes needs backport to 3.13bugs and security fixes labelsOct 8, 2024
@JelleZijlstraJelleZijlstra merged commit37228bd intopython:mainOct 8, 2024
@miss-islington-app
Copy link

Thanks@savannahostrowski for the PR, and@JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry,@savannahostrowski and@JelleZijlstra, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker 37228bd16e3ef97d32da08848552f7ef016d68ab 3.13

@miss-islington-app
Copy link

Sorry,@savannahostrowski and@JelleZijlstra, I could not cleanly backport this to3.12 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker 37228bd16e3ef97d32da08848552f7ef016d68ab 3.12

@bedevere-app
Copy link

GH-125162 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelOct 8, 2024
savannahostrowski added a commit to savannahostrowski/cpython that referenced this pull requestOct 8, 2024
(cherry picked from commit37228bd)Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>Co-authored-by: Tomas R <tomas.roun8@gmail.com>
@bedevere-app
Copy link

GH-125164 is a backport of this pull request to the3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12only security fixes labelOct 8, 2024
JelleZijlstra added a commit that referenced this pull requestOct 8, 2024
(cherry picked from commit37228bd)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>Co-authored-by: Tomas R <tomas.roun8@gmail.com>
JelleZijlstra added a commit that referenced this pull requestOct 8, 2024
(cherry picked from commit37228bd)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>Co-authored-by: Tomas R <tomas.roun8@gmail.com>
efimov-mikhail pushed a commit to efimov-mikhail/cpython that referenced this pull requestOct 9, 2024
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tomasr8tomasr8tomasr8 left review comments

@JelleZijlstraJelleZijlstraJelleZijlstra approved these changes

@willingcwillingcwillingc approved these changes

Assignees

@JelleZijlstraJelleZijlstra

Labels

docsDocumentation in the Doc dirskip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@savannahostrowski@JelleZijlstra@willingc@tomasr8

[8]ページ先頭

©2009-2025 Movatter.jp