Skip to content
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

Initial support for enabling MyPy in CI #8302

Merged
merged 10 commits into from
Jun 25, 2021
Merged

Conversation

mikepapadim
Copy link
Contributor

@mikepapadim mikepapadim commented Jun 22, 2021

This PR adds initial support for MyPy in the Jenkins pipeline.
At this point, it checks only python/tvm/runtime and python/tvm/auto_scheduler.

  1. It adds check with MyPy in linting stage,
  2. It add an option in Makefile for $ make mypy.

@jroesch @jwfromm

@tqchen
Copy link
Member

tqchen commented Jun 22, 2021

Thanks @mikepapadim ! Can we merge the mypy check to the ci lint stage? This is mainly to simplify the pipeline. We can also push the items to https://github.com/apache/tvm/blob/main/tests/scripts/task_lint.sh

@mikepapadim
Copy link
Contributor Author

Thanks @mikepapadim ! Can we merge the mypy check to the ci lint stage? This is mainly to simplify the pipeline. We can also push the items to https://github.com/apache/tvm/blob/main/tests/scripts/task_lint.sh

Sure, I will revert the changes and keep it in the lint stage.

tests/scripts/task_mypy.sh Outdated Show resolved Hide resolved
@jcf94
Copy link
Contributor

jcf94 commented Jun 23, 2021

@mikepapadim Thanks! It's really great to have type check for python codes. While seems the CI failed on mypy but it didn't throw any error?

In my understanding, mypy requires python files to specifie data type explicitly for function parameters and return values, but we have not yet add the missing data type to these two dirs in this PR?

@mikepapadim
Copy link
Contributor Author

@mikepapadim Thanks! It's really great to have type check for python codes. While seems the CI failed on mypy but it didn't throw any error?

In my understanding, mypy requires python files to specifie data type explicitly for function parameters and return values, but we have not yet add the missing data type to these two dirs in this PR?

@jcf94 you are right. This PR does not fix the missing data types, it is only enables MyPy.

At this point error logging is disabled ( by setting ignore_errors in mypy.ini). So, thats why at the end of the linting stage in Jenkins there is the following:

Checking MyPy Type defs in auto_scheduler package.

Success: no issues found in 17 source files

Checking MyPy Type defs in runtime package.

Success: no issues found in 13 source files

These two dirs are serving as placeholders atm.

Ideally, this PR adds the basic functionality.
Then, subsequent PRs can start incrementally to fix data types in specifics dirs and enable them.

@jcf94
Copy link
Contributor

jcf94 commented Jun 23, 2021

@mikepapadim Thanks, that make sense to me.

p.s. I just find a:

mypy: error: unrecognized arguments: --install-types

error in the CI log, does that need to be solved?

@mikepapadim
Copy link
Contributor Author

@mikepapadim Thanks, that make sense to me.

p.s. I just find a:

mypy: error: unrecognized arguments: --install-types

error in the CI log, does that need to be solved?
I been looking into this.
It looks like MyPy version issue. I will try to reproduce it locally.
python/mypy#10596

@comaniac
Copy link
Contributor

It's better to specify all linting/format checking tool versions (i.e., pylint, mypy, black, clang-format) to make sure the results are consistent.

@tqchen tqchen mentioned this pull request Jun 24, 2021
@tqchen tqchen merged commit 2f01315 into apache:main Jun 25, 2021
@junrushao
Copy link
Member

Finally!! Thanks for the great work!

As TensorIR is fully prepared for type annotations, we should probably check python/tvm/tir/schedule as well. CC: @Hzfengsy @tqchen

@tqchen
Copy link
Member

tqchen commented Jun 25, 2021

@junrushao1994 we can followup with a PR

@mikepapadim
Copy link
Contributor Author

Finally!! Thanks for the great work!

As TensorIR is fully prepared for type annotations, we should probably check python/tvm/tir/schedule as well. CC: @Hzfengsy @tqchen

@junrushao1994 #8367 Please have a look in this one

ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
zxy844288792 pushed a commit to zxy844288792/tvm that referenced this pull request Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants