gh-133403: Add type annotations to generate_levenshtein_examples.py#143317
gh-133403: Add type annotations to generate_levenshtein_examples.py#143317sandole wants to merge 4 commits intopython:mainfrom
Conversation
|
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 |
JelleZijlstra
left a comment
There was a problem hiding this comment.
I'm not sure we're OK with adding typing to arbitrary files. I'd prefer to get an approval from someone who works on this file.
ce4462f to
22a495d
Compare
|
I'd agree with Jelle, I also think we should weigh up churn cost for PRs in this category. This PR doesn't seem to be LLM generated at first glance, but I imagine this ('add type hints to X file') could be a magnet for such activity. A |
|
sorry guys first time contributor here but would really like to be a regular contributor who's the go-to guy for these CI / tooling changes? |
|
That would be any of the maintainer working on traceback.py. The original author's @ambv, but considering we actually didn't change this file since 2022, I think we won't ever have a change to change it in the future either. Also, please avoid updating the branch if the CI is still green. It wastes CI resources as mentioned in https://devguide.python.org/getting-started/pull-request-lifecycle/#update-branch-button (more generally, please read the devguide). |
Summary
Tools/build/generate_levenshtein_examples.pyTools/build/mypy.inito include the file for strict type checking.github/workflows/mypy.ymlto check the file in CIType annotations added
_substitution_cost,levenshtein, andmainexamplessetfrom __future__ import annotationsfor cleaner syntaxTest plan
mypy --config-file=Tools/build/mypy.ini Tools/build/generate_levenshtein_examples.pyThis continues the ongoing effort in #133403 to add type checking to more build tools.
📚 Documentation preview 📚: https://cpython-previews--143317.org.readthedocs.build/