dffml
dffml copied to clipboard
ci: Static type checking
https://github.com/Microsoft/pyright
or
https://google.github.io/pytype/user_guide.html
or
https://pyre-check.org/
Hey I can work on this. Do we have to use pyright or can we use mypy too?
mypy is weird that's why everything is borked right now. I think google's verion of things might be better: https://google.github.io/pytype/user_guide.html because it can make type annotations for functions that don't have them. I guess just mess with both and let me know what you think. I think we'll end up running google's and microsofts at the end of the day, and pylint to catch the most issue.
So, if you want to do this, id say probably start with google's, In some of the smaller more self contained files first, then let me know how its going and we'll move from there. Thanks!
I tried Pytype and I guess it's great. I saw a few repos that used mypy and are having troubles. It is quite easy to add to travis, should I do it or wait?
Well, travis is going to stop any pull requests with issues, so we need to fix all the issues before adding to travis
So ya, start a new PR, enable it in travis, and then start fixing the issues I think it the best way to move forward. Add it by creating a new function in .ci/run.sh and then adding a new environment variable to the build matrix in travis, TYPE_CHECK=1
Issues related to type checking, right? I can run pytype locally now, to fix them if it finds any.
Yes just type checking for now so we keep the PR to only about this. Thanks!!
Last thing, is it necessary to create a function? Would this work (https://github.com/google/importlab/blob/master/.travis.yml). This was provided in the documentation as an example to integrate pytype.
mypy plugin docs might be useful whenever we get to this: https://mypy.readthedocs.io/en/stable/extending_mypy.html?highlight=plugin#extending-mypy-using-plugins
Might be able to use this to validate type hints at runtime: https://pydantic-docs.helpmanual.io/
https://docs.python.org/3/library/typing.html#typing.Annotated For definitions