-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
gh-129707: Check Tools/build/compute-changes.py
with mypy
#129708
Conversation
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 use Set
rather than the concrete class.
A
When you're done making the requested changes, leave the comment: |
Tools/build/mypy.ini
Outdated
@@ -1,5 +1,5 @@ | |||
[mypy] | |||
files = Tools/build/generate_sbom.py | |||
files = Tools/build/generate_sbom.py, Tools/build/compute-changes.py |
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.
Can we make this a multi-line list? Ideally we could use a TOML file, does MyPy support mypy.toml
or .mypy.toml
?
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.
It supports pyproject.toml
, but it can affect stuff. + Our CI expects all folders to have mypy.ini
. Current version of mypy
does not support multiline strings here. But, I will fix that upstream. So, we can expect this in 1.16.0 somewhere.
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.
Seems to work like this?
files = Tools/build/generate_sbom.py, Tools/build/compute-changes.py | |
files = | |
Tools/build/compute-changes.py, | |
Tools/build/generate_sbom.py |
(Unfortunately can't add a trailing comma to the last entry.)
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.
I've created a MyPy issue to request support for mypy.toml
or similar: python/mypy#18617
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.
I will fix it shortly, sorry for the ,
bug 😢
I've fixed it several times already, but it is very persistent for some reason.
I don't quite agree about the |
Co-authored-by: Hugo van Kemenade <[email protected]>
True! My rationale is that it might make sense in some future change to use |
…i` (#18621) Now ```ini files = a.py, b.py ``` and ```ini files = a.py, b.py, ``` will be the same thing. Previously, adding a traling comma would add `''` to `paths`, which resulted in a strange error like: ``` a.py: error: Duplicate module named "a" (also at "a.py") (diff) a.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info (diff) a.py: note: Common resolutions include: a) using `--exclude` to avoid checking one of them, b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or adjusting MYPYPATH (diff) ``` Refs #14240 Refs python/cpython#129708
…ython#129708) Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
…ython#129708) Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
…i` (python#18621) Now ```ini files = a.py, b.py ``` and ```ini files = a.py, b.py, ``` will be the same thing. Previously, adding a traling comma would add `''` to `paths`, which resulted in a strange error like: ``` a.py: error: Duplicate module named "a" (also at "a.py") (diff) a.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info (diff) a.py: note: Common resolutions include: a) using `--exclude` to avoid checking one of them, b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or adjusting MYPYPATH (diff) ``` Refs python#14240 Refs python/cpython#129708
There was one error locally:
compute-changes.py
should be checked with mypy #129707