Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

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

python/mypy#4675

python/mypy#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/

python/mypy#3905

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