← 返回命令列表

Linux command

pyright 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Type check project

pyright

Type check specific files

pyright [file.py]

Watch for changes

pyright --watch

Output in JSON

pyright --outputjson

Show version

pyright --version

Create config file

pyright --createstub [package]

说明

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.

参数

--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.

FAQ

What is the pyright command used for?

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.

How do I run a basic pyright example?

Run `pyright` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --watch do in pyright?

Watch mode for changes.