GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-99749: Add optional feature to suggest correct names (ArgumentParser) by savannahostrowski · Pull Request #124456 · python/cpython

Conversation

@savannahostrowski

@savannahostrowski savannahostrowski commented Sep 24, 2024 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This PR carries #99773 forward with the original author's go-ahead (thanks @abdulrafey38!). This adds the ability for ArgumentParser to offer suggestions for mistyped argument choices or subparser names. This PR adds this as an optional feature via the suggest_on_error param (default: False).

I have opted to not make this configurable at the subparser or argument level and instead at the parser level to keep this simple. We could consider additional granularity but I'm not convinced that this is required at this time.

  • Issue: Add “maybe you meant” in argparse choices argument #99749

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

danielhollas reacted with eyes emoji
All reactions
  • 👀 1 reaction
abdulrafey38 and others added 28 commits November 25, 2022 17:07
@abdulrafey38
Add closet choice if exists in argparser if wrong choice picked
ef8e4fc
@blurb-it
📜🤖 Added by blurb_it.
7e8dcf8
@abdulrafey38
Fix documentation
8c754cd
@abdulrafey38
Added EOL 🔨
4fb8ce6
@abdulrafey38
Test cases updated for argparser
2f197b3
@abdulrafey38
Fixed typo errors 🔨
940a66e
@abdulrafey38
Test case fix 🔨
badc5ed
@abdulrafey38
Fixed test cse error msg 🔨
2588ef1
@abdulrafey38
Fixed error test case assert msg 🔨
ee05c1e
@abdulrafey38
assertion fix 🔨
4a36406
@abdulrafey38
assertion test case fix
fe169bc
@abdulrafey38
Test Case fix
9fe0d95
@abdulrafey38
Reveet to assertRegex from assertEqual
d12e1c4
@abdulrafey38
Remove unused imports 🔨
35f0961
@abdulrafey38
assertion msg fixed 🔨
087895c
@abdulrafey38
test cases fixed 🔨
6eeae5c
@abdulrafey38
assert fix
9965694
@abdulrafey38
assertion fix
4ef218a
@abdulrafey38
revert testing
e63a01c
@abdulrafey38
test: hammer:
bfc9262
@abdulrafey38
fixed
b3b4a9e
@abdulrafey38
PR review changes 🔨
b8bc465
@abdulrafey38
test case fix 🔨
ade070f
@abdulrafey38
test case fixation assertIn
3753a0d
@savannahostrowski
Merge branch 'main' into pythongh-99773
2b802ec
@savannahostrowski
Rework to add tests and make optional
f516bb4
@savannahostrowski
Add to docs
c9b40f5
@savannahostrowski
Add implicit test case
981bacd
@savannahostrowski savannahostrowski added stdlib Standard Library Python modules in the Lib/ directory 3.14 bugs and security fixes labels Sep 24, 2024
@savannahostrowski
add pr comment
8e4793c
serhiy-storchaka
serhiy-storchaka approved these changes Sep 26, 2024
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM.

This PR slightly conflicts with #117766. After merging one of them, the other one should be updated. I am not sure what of them should be merged first.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rindeal

rindeal commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

This PR slightly conflicts with #117766. After merging one of them, the other one should be updated. I am not sure what of them should be merged first.

A fix should definitely precede a new feature.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski added 5 commits October 11, 2024 16:41
@savannahostrowski
merge main
b782fbc
@savannahostrowski
fix merge conflict
73c4bd3
@savannahostrowski
Merge branch 'main' into pythongh-99773
d2c665d
@savannahostrowski
Appease linter
d1daff1
@savannahostrowski
Merge branch 'pythongh-99773' of https://github.com/savannahostrowski…
f57b4dc
…/cpython into pythongh-99773
@savannahostrowski savannahostrowski added the type-feature A feature request or enhancement label Oct 12, 2024
@serhiy-storchaka
Merge branch 'main' into pythongh-99773
f2f67e7
serhiy-storchaka
serhiy-storchaka reviewed Oct 16, 2024
View reviewed changes
Comment thread Lib/test/test_argparse.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka reviewed Oct 16, 2024
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2024-09-24-18-49-16.gh-issue-99749.gBDJX7.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski and others added 5 commits October 16, 2024 20:03
@savannahostrowski @serhiy-storchaka
Update Misc/NEWS.d/next/Library/2024-09-24-18-49-16.gh-issue-99749.gB…
3d9bbb4
…DJX7.rst

Co-authored-by: Serhiy Storchaka <[email protected]>
@savannahostrowski
Merge branch 'main' into pythongh-99773
c494469
@savannahostrowski
Test whole line
05dc55c
@savannahostrowski
Merge branch 'pythongh-99773' of https://github.com/savannahostrowski…
68b9383
…/cpython into pythongh-99773
@savannahostrowski
Fix line length
f2781cc
serhiy-storchaka
serhiy-storchaka approved these changes Oct 17, 2024
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@serhiy-storchaka
serhiy-storchaka merged commit 624be86 into python:main Oct 17, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 17, 2024
serhiy-storchaka pushed a commit that referenced this pull request Oct 19, 2024
@savannahostrowski
GH-99749: Add What's New entry for GH-124456 (GH-125671)
84074a4
@savannahostrowski savannahostrowski mentioned this pull request Nov 22, 2024
Document forward compatibility for suggest_on_error #127134
Closed
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
@savannahostrowski @ebonnal
pythonGH-99749: Add optional feature to suggest correct names (Argume…
925417c
…ntParser) (pythonGH-124456)
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
@savannahostrowski @ebonnal
pythonGH-99749: Add What's New entry for pythonGH-124456 (pythonGH-12…
7fb9a90
…5671)
@edgarrmondragon edgarrmondragon mentioned this pull request May 6, 2025
Add new Python 3.14 argparse.ArgumentParser constructor parameters python/typeshed#13947
Merged
@iritkatriel iritkatriel mentioned this pull request May 8, 2025
argparse.HelpFormatter subclasses may be broken by 3.14 changes #133653
Closed
JelleZijlstra added a commit to python/typeshed that referenced this pull request May 12, 2025
@edgarrmondragon @srittau @JelleZijlstra
Add new Python 3.14 argparse.ArgumentParser constructor parameters (#…
3f8a48f
…13947)

These are

- `suggest_on_error`, added by python/cpython#124456, made keyword-only by python/cpython#133302
- `color`, added by python/cpython#132323

Co-authored-by: Sebastian Rittau <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
mmingyu pushed a commit to mmingyu/typeshed that referenced this pull request May 16, 2025
@edgarrmondragon @srittau
@JelleZijlstra mingyu.park
Add new Python 3.14 argparse.ArgumentParser constructor parameters (p…
fc6a13f
…ython#13947)

These are

- `suggest_on_error`, added by python/cpython#124456, made keyword-only by python/cpython#133302
- `color`, added by python/cpython#132323

Co-authored-by: Sebastian Rittau <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
@hingebase hingebase mentioned this pull request Mar 15, 2025
Update to Python 3.14 hingebase/mahoraga#1
Closed
@savannahostrowski savannahostrowski mentioned this pull request Feb 19, 2026
Update argparse suggest_on_error code snippet in docs #144985
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rhettinger rhettinger rhettinger approved these changes
@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@rhettinger rhettinger

Labels

3.14 bugs and security fixes stdlib Standard Library Python modules in the Lib/ directory type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@savannahostrowski @danielhollas @rindeal @rhettinger @serhiy-storchaka @abdulrafey38
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.