- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.11.1"
hooks:
- id: mypy
files: src|tests
args: []
additional_dependencies:
- pytest
the issue with this pre-commit configuration is that if you rely on importing your package in tests where your package is defined in src, then mypy is not aware of the package you locally work on unless there are changes in src. The only workaround I've been able to dig up is to always pass in the files into mypy no matter what (see pre-commit/pre-commit#1519):
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.11.1"
hooks:
- id: mypy
files: src|tests
pass_filenames: false
args: []
additional_dependencies:
- pytest