Default MyPy type hint checks

MyPy is a Python type annotation checker. MyPy recursively checks all files in a Python project by typing:

mypy ~/myproject

We typically use the PyPI MyPy instead of conda to have the most recent MyPy version:

pip install mypy

It’s often useful to have a per-project MyPy configuration file to avoid excessive command line options. Configure MyPy defaults in pyproject.toml:

[tool.mypy]
files = ["src", "Examples"]
ignore_missing_imports = true
strict_optional = false
show_column_numbers = true

Where “files” is set appropriately for the project. Making a per-project files is strongly recommended to ensure files aren’t missed in the type check. One can make a system-wide ~/.mypy.ini, that is overridden by the per-project pyproject.toml.

Enhanced mypy usage