← 返回首页
gh-99735: Use required=True in argparse subparsers example by ppaez · Pull Request #100927 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

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

Provide feedback

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

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-99735: Use required=True in argparse subparsers example#100927

Merged
hauntsaninja merged 1 commit into
python:mainfrom
ppaez:argparse-subparsers-required
Feb 19, 2023
Merged

gh-99735: Use required=True in argparse subparsers example#100927
hauntsaninja merged 1 commit into
python:mainfrom
ppaez:argparse-subparsers-required

Conversation

ppaez commented Jan 10, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

This provides an alternate solution, suggested by @hpaulj to improve the example in the documentation.

hauntsaninja left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Thanks! While the history of the required parameter looks long and sad, I agree that required=True is what most users should default to doing.

hauntsaninja added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Feb 19, 2023
hauntsaninja changed the title gh-99735: Make providing a sub-command mandatory gh-99735: Use required=True in argparse subparsers example Feb 19, 2023
hauntsaninja merged commit 6aab56f into python:main Feb 19, 2023

Copy link
Copy Markdown
Contributor

Thanks @ppaez for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 19, 2023
…honGH-100927) (cherry picked from commit 6aab56f) Co-authored-by: Patricio Paez <nospam@pp.com.mx>

Copy link
Copy Markdown

GH-102036 is a backport of this pull request to the 3.11 branch.

bedevere-bot removed the needs backport to 3.11 only security fixes label Feb 19, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 19, 2023
…honGH-100927) (cherry picked from commit 6aab56f) Co-authored-by: Patricio Paez <nospam@pp.com.mx>

Copy link
Copy Markdown

GH-102037 is a backport of this pull request to the 3.10 branch.

bedevere-bot removed the needs backport to 3.10 only security fixes label Feb 19, 2023
miss-islington added a commit that referenced this pull request Feb 19, 2023
(cherry picked from commit 6aab56f) Co-authored-by: Patricio Paez <nospam@pp.com.mx>
miss-islington added a commit that referenced this pull request Feb 19, 2023
(cherry picked from commit 6aab56f) Co-authored-by: Patricio Paez <nospam@pp.com.mx>
carljm added a commit to carljm/cpython that referenced this pull request Feb 20, 2023
* main: (60 commits) pythongh-102056: Fix a few bugs in error handling of exception printing code (python#102078) pythongh-102011: use sys.exception() instead of sys.exc_info() in docs where possible (python#102012) pythongh-101566: Sync with zipp 3.14. (pythonGH-102018) pythonGH-99818: improve the documentation for zipfile.Path and Traversable (pythonGH-101589) pythongh-88233: zipfile: handle extras after a zip64 extra (pythonGH-96161) pythongh-101981: Apply HOMEBREW related environment variables (pythongh-102074) pythongh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (pythonGH-101912) pythongh-101819: Adapt _io types to heap types, batch 1 (pythonGH-101949) pythongh-101981: Build macOS as recommended by the devguide (pythonGH-102070) pythongh-97786: Fix compiler warnings in pytime.c (python#101826) pythongh-101578: Amend PyErr_{Set,Get}RaisedException docs (python#101962) Misc improvements to the float tutorial (pythonGH-102052) pythongh-85417: Clarify behaviour on branch cuts in cmath module (python#102046) pythongh-100425: Update tutorial docs related to sum() accuracy (FH-101854) Add missing 'is' to `cmath.log()` docstring (python#102049) pythongh-100210: Correct the comment link for unescaping HTML (python#100212) pythongh-97930: Also include subdirectory in makefile. (python#102030) pythongh-99735: Use required=True in argparse subparsers example (python#100927) Fix incorrectly documented attribute in csv docs (python#101250) pythonGH-84783: Make the slice object hashable (pythonGH-101264) ...
carljm added a commit to carljm/cpython that referenced this pull request Feb 22, 2023
* main: (225 commits) pythongh-102056: Fix a few bugs in error handling of exception printing code (python#102078) pythongh-102011: use sys.exception() instead of sys.exc_info() in docs where possible (python#102012) pythongh-101566: Sync with zipp 3.14. (pythonGH-102018) pythonGH-99818: improve the documentation for zipfile.Path and Traversable (pythonGH-101589) pythongh-88233: zipfile: handle extras after a zip64 extra (pythonGH-96161) pythongh-101981: Apply HOMEBREW related environment variables (pythongh-102074) pythongh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (pythonGH-101912) pythongh-101819: Adapt _io types to heap types, batch 1 (pythonGH-101949) pythongh-101981: Build macOS as recommended by the devguide (pythonGH-102070) pythongh-97786: Fix compiler warnings in pytime.c (python#101826) pythongh-101578: Amend PyErr_{Set,Get}RaisedException docs (python#101962) Misc improvements to the float tutorial (pythonGH-102052) pythongh-85417: Clarify behaviour on branch cuts in cmath module (python#102046) pythongh-100425: Update tutorial docs related to sum() accuracy (FH-101854) Add missing 'is' to `cmath.log()` docstring (python#102049) pythongh-100210: Correct the comment link for unescaping HTML (python#100212) pythongh-97930: Also include subdirectory in makefile. (python#102030) pythongh-99735: Use required=True in argparse subparsers example (python#100927) Fix incorrectly documented attribute in csv docs (python#101250) pythonGH-84783: Make the slice object hashable (pythonGH-101264) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Footer

© 2026 GitHub, Inc.