Skip to content

Conversation

@henzef
Copy link
Contributor

@henzef henzef commented Nov 29, 2023

For actions with required=True, the ArgumentDefaultsHelpFormatter would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.

…tter

For actions with required=True, the ArgumentDefaultsHelpFormatter would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.
@ghost
Copy link

ghost commented Nov 29, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Nov 29, 2023

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@henzef
Copy link
Contributor Author

henzef commented Nov 29, 2023

I think it's minor enough to not require a news entry. Just let me know if you think otherwise.

@bedevere-app
Copy link

bedevere-app bot commented Dec 6, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Thank you for your PR, @henzef, it looks interesting. Sorry that it took so much time to review it. Could you please add some tests?

@serhiy-storchaka
Copy link
Member

And while this is not a major change, it fixes a weird behavior, and many users will be happy to hear this. This is why we have NEWS entries.

@bedevere-app
Copy link

bedevere-app bot commented Dec 9, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@henzef
Copy link
Contributor Author

henzef commented Dec 9, 2025

I added unit tests and a news entry

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. 👍

@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) December 9, 2025 16:26
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Dec 9, 2025
@serhiy-storchaka serhiy-storchaka changed the title gh-112527: Improve help text for required actions in DefaultsHelpFormatter gh-112527: Fix help text for required options in argparse Dec 9, 2025
@serhiy-storchaka serhiy-storchaka merged commit 1adb17b into python:main Dec 9, 2025
54 checks passed
@miss-islington-app
Copy link

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

@miss-islington-app
Copy link

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

cherry_picker 1adb17b1a26e1547d14ca15f915e605cfdda3edd 3.14

@miss-islington-app
Copy link

Sorry, @henzef and @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 1adb17b1a26e1547d14ca15f915e605cfdda3edd 3.13

serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request Dec 9, 2025
pythonGH-112528)

For optional arguments with required=True, the ArgumentDefaultsHelpFormatter
would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.
(cherry picked from commit 1adb17b)

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

bedevere-app bot commented Dec 9, 2025

GH-142475 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Dec 9, 2025
serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request Dec 9, 2025
pythonGH-112528)

For optional arguments with required=True, the ArgumentDefaultsHelpFormatter
would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.
(cherry picked from commit 1adb17b)

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

bedevere-app bot commented Dec 9, 2025

GH-142477 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 Dec 9, 2025
serhiy-storchaka added a commit that referenced this pull request Dec 9, 2025
…112528) (GH-142475)

For optional arguments with required=True, the ArgumentDefaultsHelpFormatter
would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.
(cherry picked from commit 1adb17b)

Co-authored-by: Fabian Henze <[email protected]>
serhiy-storchaka added a commit that referenced this pull request Dec 9, 2025
…112528) (GH-142477)

For optional arguments with required=True, the ArgumentDefaultsHelpFormatter
would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.
(cherry picked from commit 1adb17b)

Co-authored-by: Fabian Henze <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve help text in ArgumentDefaultsHelpFormatter for required actions

2 participants