Ben Chuanlong Du's Blog

It is never too late to learn.

Static Type Checking of Python Scripts Using Mypy

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

--check-untyped-defs

You can use the option --ignore-missing-imports to disable the annoying error messages No library stub file for module.... Please see the issue for more details.

You can use # type: ignore to silence some errors. Please see the issue for more details.

import foo # type: ignore foo.f() # okay

Third-party Stubs

data-science-types

pyspark-stubs

Ingore Files and/or Directories

https://github.com/python/mypy/issues/4675

https://github.com/python/mypy/issues/626

References

https://realpython.com/python-type-checking/#pros-and-cons

https://mypy.readthedocs.io/en/latest/index.html

https://mypy.readthedocs.io/en/latest/common_issues.html

https://mypy.readthedocs.io/en/latest/common_issues.html#displaying-the-type-of-an-expression

https://mypy.readthedocs.io/en/latest/kinds_of_types.html#kinds-of-types

https://realpython.com/python-type-checking/

https://github.com/python/mypy/issues/3905

https://mypy.readthedocs.io/en/latest/config_file.html

Comments