LinuxCommandLibrary

mypy

static type checker for Python

TLDR

Type check file

$ mypy [script.py]
copy
Type check directory
$ mypy [src/]
copy
Strict mode
$ mypy --strict [script.py]
copy
Ignore missing imports
$ mypy --ignore-missing-imports [script.py]
copy
Show error codes
$ mypy --show-error-codes [script.py]
copy
Check specific Python version
$ mypy --python-version [3.10] [script.py]
copy
Generate HTML report
$ mypy --html-report [report/] [script.py]
copy

SYNOPSIS

mypy [options] files

DESCRIPTION

mypy is a static type checker for Python. It validates type annotations.
The tool catches type errors before runtime. Supports gradual typing adoption.

PARAMETERS

FILES

Python files to check.
--strict
Enable strict checking.
--ignore-missing-imports
Skip untyped modules.
--show-error-codes
Display error codes.
--python-version VER
Target Python version.
--help
Display help information.

CAVEATS

Requires type annotations. Third-party stubs may be needed. Optional strict mode.

HISTORY

mypy was created by Jukka Lehtosalo and is developed at Dropbox as the premier Python type checker.

SEE ALSO

python(1), pyright(1), pylint(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community