-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-104504: Run mypy on cases_generator in CI (and blacken the code) #108090
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
Conversation
I am not typing expert, so there might be a more promising way to attach type hints for this.
|
cc @sobolevn |
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.
You might also want to alter .github/dependabot.yml
, so that you get automated updates for the mypy version pin in Tools/cases_generator/requirements-dev.txt
. Currently it only checks to see if dependencies in Tools/clinic/
need updating:
cpython/.github/dependabot.yml
Lines 15 to 21 in 75b3db8
- package-ecosystem: "pip" | |
directory: "/Tools/clinic/" | |
schedule: | |
interval: "monthly" | |
labels: | |
- "skip issue" | |
- "skip news" |
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.
Thanks so much for doing this!
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.
(Please don't git push -f
-- it makes the GitHub review reset so I can't do "changes since last review".)
.github/workflows/mypy.yml
Outdated
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" |
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.
Are there constraints on x
? The cases generator uses match
/case
so it's got to be at least Python 3.10.
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.
Let's use 3.11. We need dog fooding
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.
3.x
is "the latest stable version of Python":
https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#specifying-a-python-version
That's 3.11 now, and will be 3.12 shortly after its release.
So 3.x
would be fine to minimise churn on this line (for next time).
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.
So 3.x would be fine to minimise churn on this line (for next time).
Good!
if popped is None and pushed is None: | ||
popped, pushed = target_popped, target_pushed | ||
else: | ||
assert popped == target_popped | ||
assert pushed == target_pushed | ||
popped, pushed = target_popped, target_pushed |
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.
Those asserts need to stay -- per the comment on line 174-175, we're checking here that all targets of the pseudo have the same effects.
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.
Thanks for taking black out.
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. Don't worry about the origin of the Iterator type.
Waiting comments of @AlexWaygood @hugovk before merging :) |
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.
FYI: You could actually use Argument Clinic to generate the Python code for the keywords. (Argument Clinic supports Python files.) I'm not suggesting you do it for this PR, though; just a thought :)
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.
Wow, Can I read the relevant documentation?
Co-authored-by: Alex Waygood <[email protected]>
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, thanks! :D
Thanks! |
mypy
oncases_generator
#104504