-
Notifications
You must be signed in to change notification settings - Fork 49
feat: Enable mypy type checking #35
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
./python and ./tests
3250407 to
57b12df
Compare
./python and ./tests14fbc9e to
03f3629
Compare
| class _TestCxxClassDerivedDerived(_TestCxxClassDerived): | ||
| v_str: str = field(default_factory=lambda: "default") | ||
| v_bool: bool | ||
| v_str: str = field(default_factory=lambda: "default") # type: ignore[assignment] |
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.
TODO: need to figure out why field(...) triggers a mypy complain, despite field_specifiers are used properly
03f3629 to
bdbbde4
Compare
|
Looks like the only controversy [1][2] is whether or not we want generated methods to be put under I don't really have strong opinion so @tqchen you may make the call. Arguments on both sides are valid:
|
|
if correctness is not an issue, i feel not put under |
9af2a97 to
32307ff
Compare
acaa39d to
934993f
Compare
934993f to
52eba1b
Compare
python/tvm_ffi/testing.py
Outdated
| from .registry import register_object | ||
|
|
||
| if TYPE_CHECKING: | ||
| from tvm_ffi import Array, Map |
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.
Given array map is used below (and notunder type chekcing), should it now not use type checking? or use String?
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.
the original intention is to avoid potential cyclic dependencies, but indeed there's no cyclic dependency in this case. will remove
python/tvm_ffi/_ffi_api.py
Outdated
|
|
||
| from . import registry | ||
|
|
||
| if TYPE_CHECKING: |
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.
get rid of this TYPE_CHECKING or move to a pyi file
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.
will move to a pyi file
52eba1b to
85b8928
Compare
85b8928 to
8dfcb68
Compare
With this PR, we are able to enable mypy type checking for the following directories:
python/andtests/examples/inline_moduleexamples/packagingexamples/quick_start