-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[Tests] Ensure MyPy type checks pass #9284
Merged
Merged
Conversation
This file contains 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
There's a few errors that come up when type checking that aren't triggering any failures: ``` Checking MyPy Type defs in the meta schedule package. python/tvm/meta_schedule/utils.py:23:1: error: Cannot find implementation or library stub for module named "psutil" python/tvm/meta_schedule/utils.py:23:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports python/tvm/meta_schedule/search_strategy/search_strategy.py: note: In member "__init__" of class "MeasureCandidate": python/tvm/meta_schedule/search_strategy/search_strategy.py:59:13: error: Module has no attribute "MeasureCandidate" python/tvm/meta_schedule/search_strategy/search_strategy.py: note: In member "initialize_with_tune_context" of class "SearchStrategy": python/tvm/meta_schedule/search_strategy/search_strategy.py:83:9: error: Module has no attribute "SearchStrategyInitializeWithTuneContext" ``` To rectify this the `types-psutil` package adds type hints for `mypy` and `# type: ignore` stops `mypy` from trying to figure out types of `_ffi_api` resources. There's also a few places where variable type definitions are repeated even though they're only required once. Finally, I've ensured `task_mypy.sh` fails the build since it's stable right now, using `set -e`.
Mousius
added a commit
to Mousius/tvm
that referenced
this pull request
Oct 14, 2021
Spun out from apache#9284 as I think we need to update the image to get this in?
cc @mikepapadim |
LGMT, thanks @Mousius |
mikepapadim
approved these changes
Oct 14, 2021
cc @areusch |
areusch
approved these changes
Oct 14, 2021
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 @Mousius !
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 7, 2022
* [Tests] Ensure MyPy type checks pass There's a few errors that come up when type checking that aren't triggering any failures: ``` Checking MyPy Type defs in the meta schedule package. python/tvm/meta_schedule/utils.py:23:1: error: Cannot find implementation or library stub for module named "psutil" python/tvm/meta_schedule/utils.py:23:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports python/tvm/meta_schedule/search_strategy/search_strategy.py: note: In member "__init__" of class "MeasureCandidate": python/tvm/meta_schedule/search_strategy/search_strategy.py:59:13: error: Module has no attribute "MeasureCandidate" python/tvm/meta_schedule/search_strategy/search_strategy.py: note: In member "initialize_with_tune_context" of class "SearchStrategy": python/tvm/meta_schedule/search_strategy/search_strategy.py:83:9: error: Module has no attribute "SearchStrategyInitializeWithTuneContext" ``` To rectify this the `types-psutil` package adds type hints for `mypy` and `# type: ignore` stops `mypy` from trying to figure out types of `_ffi_api` resources. There's also a few places where variable type definitions are repeated even though they're only required once. Finally, I've ensured `task_mypy.sh` fails the build since it's stable right now, using `set -e`. * Add temporary # type : ignore for psutil
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 13, 2022
* [Tests] Ensure MyPy type checks pass There's a few errors that come up when type checking that aren't triggering any failures: ``` Checking MyPy Type defs in the meta schedule package. python/tvm/meta_schedule/utils.py:23:1: error: Cannot find implementation or library stub for module named "psutil" python/tvm/meta_schedule/utils.py:23:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports python/tvm/meta_schedule/search_strategy/search_strategy.py: note: In member "__init__" of class "MeasureCandidate": python/tvm/meta_schedule/search_strategy/search_strategy.py:59:13: error: Module has no attribute "MeasureCandidate" python/tvm/meta_schedule/search_strategy/search_strategy.py: note: In member "initialize_with_tune_context" of class "SearchStrategy": python/tvm/meta_schedule/search_strategy/search_strategy.py:83:9: error: Module has no attribute "SearchStrategyInitializeWithTuneContext" ``` To rectify this the `types-psutil` package adds type hints for `mypy` and `# type: ignore` stops `mypy` from trying to figure out types of `_ffi_api` resources. There's also a few places where variable type definitions are repeated even though they're only required once. Finally, I've ensured `task_mypy.sh` fails the build since it's stable right now, using `set -e`. * Add temporary # type : ignore for psutil
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's a few errors that come up when type checking that aren't triggering any failures:
To rectify this the
types-psutil
package adds type hints formypy
(will update later to remove the ignore on this once the docker image is rebuilt) and# type: ignore
stopsmypy
from trying to figure out types of_ffi_api
resources.There's also a few places where variable type definitions are repeated even though they're only required once.
Finally, I've ensured
task_mypy.sh
fails the build since it's stable right now, usingset -e
.