LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

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 all optional error-checking flags (strict mode).
--ignore-missing-imports
Silence errors about imports that cannot be resolved.
--show-error-codes
Display error codes in messages (default in recent versions).
--python-version X.Y
Type check code as if running on the specified Python version.
--disallow-untyped-defs
Disallow defining functions without type annotations.
--follow-imports MODE
How to handle imports (normal, silent, skip, error).
--html-report DIR
Generate HTML type-check coverage report (requires lxml).
--install-types
Install missing third-party type stubs automatically.
--namespace-packages
Support PEP 420 namespace packages.
--config-file FILE
Use specific mypy configuration file.
--help
Display help information.

INSTALL

sudo pacman -S mypy
copy
sudo apk add py3-mypy
copy
brew install mypy
copy
nix profile install nixpkgs#mypy
copy

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), ruff(1), black(1), flake8(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid