Go to file
Github Actions 26de8945da Mirror: 1.6.1 2023-10-18 08:31:23 +00:00
.github/workflows Use org-default .github/FUNDING.yml 2022-09-27 14:50:18 -04:00
.pre-commit-hooks.yaml Mirror: 0.940 2022-03-12 08:34:13 +00:00
.version Mirror: 1.6.1 2023-10-18 08:31:23 +00:00
LICENSE Add LICENSE from pre-commit-mirror-maker 2021-04-19 19:11:56 -07:00
README.md Remove example flag that we must not speak of 2023-04-30 15:54:24 -07:00
setup.py Mirror: 1.6.1 2023-10-18 08:31:23 +00:00

README.md

mypy mirror

Mirror of mypy for pre-commit.

For pre-commit: see https://github.com/pre-commit/pre-commit For mypy: see https://github.com/python/mypy

Using mypy with pre-commit:

Add this to your .pre-commit-config.yaml

-   repo: https://github.com/pre-commit/mirrors-mypy
    rev: ''  # Use the sha / tag you want to point at
    hooks:
    -   id: mypy

By default, mypy will run with mypy --ignore-missing-imports, pre-commit runs mypy from an isolated virtualenv so it won't have access to those. To change the arguments, override the args as follows:

    hooks:
    -   id: mypy
        args: [--strict, --ignore-missing-imports]

Because pre-commit runs mypy from an isolated virtualenv (without your dependencies) you may also find it useful to add the typed dependencies to additional_dependencies so mypy can better perform dynamic analysis:

    hooks:
    -   id: mypy
        additional_dependencies: [tokenize-rt==3.2.0]

Note that using the --install-types is problematic. Mutating the pre-commit environment at runtime breaks cache and will break parallel builds.