-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Type annotations and mypy #4698
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
Comments
Hi! thanks for your contribution!, great first issue! |
Would the checks fail the build or just be informative? |
Hi @carmocca , I think it would be just informative in the beginning. But in the long run it should fail the builds. |
@gianscarpe what would be the difference to |
Hi @Borda, Thanks for your replay! I didn't notice pyright configuration in the root repository. I think (correct me if I'm wrong) that pyright check is not explicitly mandatory neither it's part of pre-commit pipeline. I would consider moving the project in this direction and add static type checking for tests code as well |
we have this test in CI - https://github.com/PyTorchLightning/pytorch-lightning/blob/8601268c70649f49767001098adbf665a93843df/.github/workflows/code-formatting.yml#L41 |
My issue was more about type checking in general. So I totally agree! I would focus on fix the typing in the code and eventually introduce it as a pre-commit hook! |
COOL, let's follow the per-partez strategy as we also have for imports fixing #4805 |
I feel we can close this one and continue type improvements talks in #855 |
@gianscarpe it seems we have some problems with pyright
I think that maybe it would be easier to move to mypy? @akihironitta |
I totally agree! @Borda find it reasonable. Moreover, I think extending static type checking coverage should be taken into consideration in future milestones :) |
@gianscarpe do you mean #5023? |
Exactly! @Borda |
🚀 Feature
Introduce mypy in pre-commit pipeline
Motivation
Static type checking is an interesting and powerful technique to assure high code quality and standard. I believe it should be unvaluable to start introducing type annotation and add
mypy
among pre-commit hooksPitch
I want to check the correctness of types annotation with a static type checking. When I commit, the checker should verify and eventually notify the contributer to check his code
Alternatives
Additional context
I ran
mypy
onto tests and it heighights some deprecated calls (such ascheckpoint_callback
, now incallbacks
list). These checks could be useful to static check tests and find avoid obsolescent testsThe text was updated successfully, but these errors were encountered: