Skip to content

mypy

(https://mypy.readthedocs.io/en/stable/) is a static type checker for Python.

Usage

Pre-commit hook

To use mypy as a pre-commit hook, add:

  - repo: 'https://github.com/pre-commit/mirrors-mypy'
    rev: ''
    hooks:
      - id: 'mypy'
        args: 
        additional_dependencies:
          - 'pydantic'

For extended support for (pydantic.md) don't forget to add the additional dependency and enable the plugin in pyproject.toml with:

# --------- mypy -------------


plugins = 

Tips

Ignore type checking in one line

To ignore type checking in one particular line of the code, add the comment # type: ignore at the end of that line