Skip to content

Pyright

Pyright is a static type checker for python created by Microsoft and designed for speed and configurability.

Installing

PyPi

Note

I am the maintainer of the pyright PyPI package which is a wrapper over the official version.

You can install pyright using pip.

pip install pyright

npm

The official version of pyright can be installed from npm, to install globally run the command:

npm install -g pyright

Configuration

Pyright can be configured from either a pyproject.toml file or a pyrightconfig.json file, see the official documentation for more options.

pyproject.toml

[tool.pyright]
typeCheckingMode = "strict"

pyrightconfig.json

{
    "typeCheckingMode": "strict"
}

Running

After using any of the installation methods listed above, pyright should now be in your PATH and you can execute as shown:

pyright