Static type checker for Python with command-line tool and language server capabilities
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Complete command-line interface for Python static type checking with extensive configuration options and output formats.
Primary interface for static type analysis of Python code.
pyright [options] files...Control the scope and behavior of type analysis.
--createstub <IMPORT>
# Create type stub file(s) for the specified import
--level <LEVEL>
# Set minimum diagnostic level: "error" or "warning"
--skipunannotated
# Skip analysis of functions with no type annotations
--verifytypes <PACKAGE>
# Verify type completeness of a py.typed package
--ignoreexternal
# Ignore external imports for --verifytypes (only valid with --verifytypes)Usage Examples:
# Create type stubs for a package
pyright --createstub requests
# Only show errors, hide warnings
pyright --level error src/
# Skip unannotated functions
pyright --skipunannotated
# Verify package type completeness
pyright --verifytypes mypackageConfigure the Python environment and interpreter settings.
--pythonplatform <PLATFORM>
# Analyze for specific platform: "Darwin", "Linux", or "Windows"
--pythonpath <FILE>
# Path to the Python interpreter executable
--pythonversion <VERSION>
# Analyze for specific Python version: "3.3", "3.4", "3.7", "3.8", "3.9", "3.10", "3.11", etc.
-v, --venvpath <DIRECTORY>
# Directory that contains virtual environments
-t, --typeshedpath <DIRECTORY>
# Use typeshed type stubs at this locationUsage Examples:
# Check for Linux compatibility
pyright --pythonplatform Linux
# Use specific Python version
pyright --pythonversion 3.9
# Set virtual environment path
pyright --venvpath ./venvs
# Use custom typeshed location
pyright --typeshedpath ./custom-typeshedSpecify project files and configuration settings.
-p, --project <FILE OR DIRECTORY>
# Use configuration file at this location
files...
# Python files to analyze (default positional argument)
-
# Read file list from stdinUsage Examples:
# Use specific config file
pyright --project ./myconfig.json
# Analyze specific files
pyright src/main.py tests/test_main.py
# Read file list from stdin
echo "src/main.py src/utils.py" | pyright -Control the format and verbosity of analysis output.
--outputjson
# Output results in JSON format instead of text
--verbose
# Emit verbose diagnostics and additional information
--stats
# Print detailed performance statistics
--dependencies
# Emit import dependency information
--warnings
# Use exit code of 1 if warnings are reported (in addition to errors)Usage Examples:
# Get machine-readable JSON output
pyright --outputjson > results.json
# Show detailed performance information
pyright --stats --verbose
# Show import dependencies
pyright --dependencies
# Treat warnings as errors for CI
pyright --warningsConfigure execution behavior and performance.
--threads <optional COUNT>
# Use separate threads to parallelize type checking
# If COUNT is omitted or "auto", uses CPU core count (minimum 4)
-w, --watch
# Continue to run and watch for file changes
--help, -h
# Show help message and exit
--version
# Print Pyright version and exitUsage Examples:
# Use automatic thread count
pyright --threads
# Use specific thread count
pyright --threads 8
# Watch mode for continuous checking
pyright --watch
# Show version information
pyright --versionThese options are still supported but deprecated in favor of newer alternatives:
--lib
# DEPRECATED: Pyright now defaults to using library code to infer types
--venv-path <DIRECTORY>
# DEPRECATED: Use --venvpath instead
--typeshed-path <DIRECTORY>
# DEPRECATED: Use --typeshedpath insteadSome options are mutually exclusive:
--outputjson incompatible with:
--stats, --verbose, --createstub, --dependencies--verifytypes incompatible with:
--watch, --stats, --createstub, --dependencies, --skipunannotated, --threads--createstub incompatible with:
--watch, --stats, --verifytypes, --dependencies, --skipunannotated, --threads--threads incompatible with:
--watch, --stats, --dependencies--pythonpath incompatible with:
--venv-path, --venvpathThe CLI respects configuration files in the following order:
--project optionpyrightconfig.json in current directorypyproject.toml with [tool.pyright] section in current directoryenum ExitStatus {
NoErrors = 0, // Successful execution with no errors
ErrorsReported = 1, // Type errors were found
FatalError = 2, // Fatal error occurred during execution
ConfigFileParseError = 3, // Configuration file parsing failed
ParameterError = 4, // Invalid command-line parameters
}When using --threads:
# Direct file arguments
pyright file1.py file2.py
# Glob patterns (shell expansion)
pyright src/**/*.py
# Configuration-based discovery
pyright --project pyrightconfig.json
# Stdin file list
echo "file1.py file2.py" | pyright -Pyright respects these environment variables:
PYTHONPATH - Additional module search paths--threads for large codebases (>100 files)--watch mode for development workflows--skipunannotated to focus on typed codeinclude/exclude patterns in config files--level error to reduce noise in CI environmentsInstall with Tessl CLI
npx tessl i tessl/npm-pyright