Static type checker for Python with command-line tool and language server capabilities
npx @tessl/cli install tessl/npm-pyright@1.1.0Pyright is a full-featured, standards-based static type checker for Python designed for high performance and compatibility with large Python source bases. It provides both a command-line tool and Visual Studio Code extension, offering comprehensive Python type checking capabilities including support for type annotations, generics, protocol checking, and advanced type inference.
npm install -g pyrightPyright is designed as a CLI tool and language server, not as a Node.js library. It does not export modules for programmatic use.
Available interfaces:
pyrightpyright-langserver# Check all Python files in current directory
pyright
# Check specific files
pyright src/main.py src/utils.py
# Check files with configuration
pyright --project ./pyrightconfig.json
# Get JSON output for tooling integration
pyright --outputjson src/
# Watch for file changes
pyright --watch# Install globally
npm install -g pyright
# Verify installation
pyright --version
# Show help
pyright --helpPyright is built around several key components:
Complete command-line type checking tool with extensive configuration options, multi-threading support, and structured output formats.
pyright [options] files...Key features:
LSP-compliant language server providing real-time type checking and IntelliSense features for Python development environments.
pyright-langserverKey features:
Structured diagnostic and analysis output for integration with development tools and CI/CD pipelines.
interface PyrightJsonResults {
version: string;
time: string;
generalDiagnostics: PyrightJsonDiagnostic[];
summary: PyrightJsonSummary;
typeCompleteness?: PyrightTypeCompletenessReport;
}Key features:
enum ExitStatus {
NoErrors = 0,
ErrorsReported = 1,
FatalError = 2,
ConfigFileParseError = 3,
ParameterError = 4,
}Pyright supports configuration through:
pyrightconfig.json - JSON configuration filepyproject.toml - TOML configuration in [tool.pyright] section{
"include": ["src"],
"exclude": ["**/__pycache__"],
"typeCheckingMode": "strict",
"pythonVersion": "3.9",
"reportMissingImports": true
}# Basic type checking with error exit code
pyright
# JSON output for parsing results
pyright --outputjson > pyright-results.json
# Check specific severity level
pyright --level errorUse pyright-langserver binary with LSP-compatible editors:
# Verify type completeness of a package
pyright --verifytypes mypackage --outputjsonThis generates detailed type completeness reports for library maintainers and consumers.