FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-104504: Run mypy on cases_generator in CI (and blacken the code) by corona10 · Pull Request #108090 · python/cpython · GitHub

/ cpython Public

gh-104504: Run mypy on cases_generator in CI (and blacken the code) - #108090

Merged
corona10 merged 17 commits into
python:mainfrom
corona10:gh-104504
Aug 18, 2023
Merged

gh-104504: Run mypy on cases_generator in CI (and blacken the code)#108090
corona10 merged 17 commits into
python:mainfrom
corona10:gh-104504

Conversation

corona10 commented Aug 17, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

corona10 commented Aug 17, 2023
edited
Loading

Copy link
Copy Markdown
Member Author

I am not typing expert, so there might be a more promising way to attach type hints for this.

Copy link
Copy Markdown
Member Author

cc @sobolevn

Comment thread Tools/cases_generator/mypy.ini Outdated
Comment thread Tools/cases_generator/formatting.py Outdated
Comment thread Tools/cases_generator/generate_cases.py Outdated
Comment thread .github/workflows/mypy.yml Outdated

AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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:

- package-ecosystem: "pip"
directory: "/Tools/clinic/"
schedule:
interval: "monthly"
labels:
- "skip issue"
- "skip news"

Comment thread Tools/cases_generator/lexer.py Outdated

gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks so much for doing this!

Comment thread Tools/cases_generator/generate_cases.py Outdated
Comment thread .github/workflows/mypy.yml Outdated
corona10 requested review from gvanrossum and hugovk August 18, 2023 00:30

gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

(Please don't git push -f -- it makes the GitHub review reset so I can't do "changes since last review".)

Comment thread .github/workflows/lint.yml Outdated
Comment thread .github/workflows/mypy.yml Outdated
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Are there constraints on x? The cases generator uses match/case so it's got to be at least Python 3.10.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Let's use 3.11. We need dog fooding

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

So 3.x would be fine to minimise churn on this line (for next time).

Good!

Comment thread Tools/cases_generator/generate_cases.py Outdated
Comment on lines +186 to +184
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread Tools/cases_generator/formatting.py Outdated

gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for taking black out.

corona10 requested a review from gvanrossum August 18, 2023 02:44

gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. Don't worry about the origin of the Iterator type.

corona10 commented Aug 18, 2023
edited
Loading

Copy link
Copy Markdown
Member Author

Waiting comments of @AlexWaygood @hugovk before merging :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Wow, Can I read the relevant documentation?

Comment thread Tools/cases_generator/mypy.ini Outdated
corona10 and others added 2 commits August 18, 2023 16:21
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, thanks! :D

AlexWaygood changed the title gh-104504: Run mypy on cases_generator gh-104504: Run mypy on cases_generator in CI (and blacken the code) Aug 18, 2023
corona10 merged commit 28cab71 into python:main Aug 18, 2023
corona10 deleted the gh-104504 branch August 18, 2023 13:42

Copy link
Copy Markdown
Member

Thanks!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL