LinuxCommandLibrary

pyright

TLDR

Type check project

$ pyright
copy
Type check specific files
$ pyright [file.py]
copy
Watch for changes
$ pyright --watch
copy
Output in JSON
$ pyright --outputjson
copy
Show version
$ pyright --version
copy
Create config file
$ pyright --createstub [package]
copy

SYNOPSIS

pyright [options] [files...]

DESCRIPTION

pyright is a static type checker for Python. It analyzes Python code for type errors without running it, providing fast feedback in editors and CI pipelines.
The tool implements the Python type system from PEP 484 and subsequent typing PEPs, offering strict checking and IDE integration.

PARAMETERS

--watch

Watch mode for changes.
--outputjson
JSON output format.
--project dir
Project root directory.
--pythonplatform platform
Target platform.
--pythonversion version
Target Python version.
--level level
Diagnostic level (basic, standard, strict).
--stats
Show performance statistics.
--verifytypes package
Verify package types.
--createstub package
Generate stub files.

CAVEATS

Requires type annotations for full benefit. Some dynamic patterns hard to type. Configuration needed for complex projects. Not all libraries have type stubs.

HISTORY

Pyright was developed by Microsoft and released in 2019. It powers Python language support in VS Code through Pylance. Written in TypeScript, it focuses on performance and standards compliance.

SEE ALSO

mypy(1), python(1), pylint(1), flake8(1)

Copied to clipboard