Skip to content

Fix argparse for Python 3.14 #19020

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 1 commit into from
May 3, 2025
Merged

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented May 3, 2025

python/cpython#132323 added an optional color argument to ArgumentParser. As a side effect the help formatters are now called with two new keyword arguments prefix_chars and color. Add **kwargs to the custom AugmentedHelpFormatter and pass it through to the super class.

Copy link
Contributor

github-actions bot commented May 3, 2025

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks!

@hauntsaninja hauntsaninja merged commit d68ea35 into python:master May 3, 2025
18 checks passed
@cdce8p cdce8p deleted the fix-argparse-3.14 branch May 3, 2025 10:55
@srittau
Copy link
Contributor

srittau commented May 9, 2025

This is the only remaining blocker for supporting Python 3.14 in typeshed (python/typeshed#13957). Is a release with this fix planned in the next few days? Otherwise I'd try to install mypy directly from GitHub in typeshed's CI.

@hauntsaninja
Copy link
Collaborator

There are rumours of a release soon in #18739

But doesn't really hurt to install mypy directly from master... we've done it so many times in typeshed history

mdickinson added a commit to mdickinson/simplefractions that referenced this pull request May 17, 2025
This PR:

- adds the missing `py.typed` marker file that indicates to consumers
that the code has usable type hints
- moves type checks to the test job of `on-commit` GitHub Actions
workflow, instead of the style job. (Those type checks are
Python-version dependent, and we want our type hints to be valid for all
supported Python versions.)
- fixes type hints to be Python 3.8-compatible on the
`fraction_to_float.py` script

Note: we're hitting a (known, fixed in main) issue with mypy and Python
3.14, so we skip the type check on Python 3.14 for now. xref:
python/mypy#19020
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.

3 participants