Basedpyright static type checker for Python. Use when setting up type checking, configuring LSP, or comparing type checkers (basedpyright, pyright, mypy alternative).
# Start with basic mode
[tool.basedpyright]
typeCheckingMode = "basic"
include = ["src/new_module"] # Type check new code only
# Gradually expand
include = ["src/new_module", "src/api"]
# Eventually enable strict mode
typeCheckingMode = "strict"
include = ["src"]
Choosing a Type Checker
Factor
Basedpyright
Pyright
mypy
Speed
Fastest
Fastest
Slower
Strictness
Strictest defaults
Configurable
Configurable
LSP Support
Built-in
Built-in
Via dmypy
Plugin System
Limited
Limited
Extensive
Choose Basedpyright for maximum type safety with stricter defaults and fastest speed. Choose Pyright for Microsoft's official support and VS Code Pylance compatibility. Choose mypy for extensive plugin ecosystem (django-stubs, pydantic-mypy).
Inline Error Suppression
# Inline type ignore
result = unsafe_operation() # type: ignore[reportUnknownVariableType]
# Function-level ignore
def legacy_function(): # basedpyright: ignore
pass
Agentic Optimizations
Context
Command
Quick check
basedpyright
JSON output
basedpyright --outputjson
Watch mode
basedpyright --watch
CI check
uv run basedpyright
Verbose
basedpyright --verbose
Quick Reference
Flag
Description
--watch
Watch mode for development
--outputjson
JSON output for tooling
--verbose
Verbose diagnostics
--pythonversion X.Y
Override Python version
--level <mode>
Override type checking mode
For detailed configuration options, LSP integration, migration guides, CI setup, and best practices, see [REFERENCE.md](REFERENCE.md).