Features¶
Zuban passes over 95% of Mypy’s relevant test suite, closely matching Mypy’s behavior. Zuban has full LSP (Language Server Protocol) support and you should therefore be able to use Zuban in any LSP compatible editor.
If you’re experiencing issues but are otherwise satisfied with performance, you can report them via GitHub Issues. For commercial support or prioritized help, contact info (at) zubanls.com.
Features¶
The full specification of the Python typing system can be found on typing.python.org. Any deviations from this specification are considered bugs and will be addressed promptly. Below is a list of the features supported by Zuban, along with their corresponding PEPs.
The conformance tests show the current compliance with the spec for the different type checkers.
Type System Support¶
Generic types - Full support for TypeVar, bounded types, variance, etc. (PEP 484)
Overloads / NewType / NamedTuple / Enum support (PEP 484)
Type Parameter Syntax:
class Foo[T]: ...(PEP 695)Protocols and structural subtyping (PEP 544).
Union and Optional types - including the new
X | Ysyntax (PEP 604)Literal types (PEP 586).
Final (PEP 591), Annotated (PEP 593), and ClassVar (PEP 526)
TypeVarTuple / Variadic Generics (PEP 646
ParamSpec/Concatenate support (PEP 612)
Self Types (PEP 673)
Dataclass and
dataclass_transformsupport (PEP 681)TypedDict support (PEP 589) including Required / NotRequired (PEP 655), kwargs unpacking (PEP 692) and read-only items (PEP 705)
Explicit Type Aliases (PEP 613)
Override decorator (PEP 698)
TypeVar/TypeVarTuple/ParamSpec defaults (PEP 696)
Narrowing types with TypeGuard (PEP 647) and TypeIs (PEP 742)
Literal strings (PEP 675), note that this is not implemented in Mypy
Marking deprecations using the type system (PEP 702)
Disjoint bases ([PEP 800])
and probably more that have been omitted here
General Code Understanding¶
Correct resolution of relative, absolute, and stub-only (
.pyi) importsType narrowing - Based on isinstance, assert, if conditions, etc
Inferring the type context (e.g.
x: list[object] = [1])Mypy’s
--new-type-inference(enabled by default in Mypy 1.7.0)Understanding
list.append,list.extend,set.addandset.extend
Development Tooling¶
Error recovery - Can recover gracefully from invalid Python syntax.
Mypy config compatibility - Honors
.mypy.ini,mypy.ini, orpyproject.tomlsettingsIncremental checking - Only rechecks changed files for performance when running the language server
LSP protocol support (diagnostics, completions, goto, rename, references, document highlights and hover)
Code action support (Auto imports, adding
# type: ignore[<some-code>])Watch mode - Rechecks files automatically on change.
Works on Linux (x86-64, AArch64, ARMv7, i686), Mac (ARM & x86-64) and Windows (x86-64 and i686)
Performance¶
Zuban is written in Rust for high performance. It runs on a single core but is already over 20× faster than Mypy. Multi-core support is planned. existing performance.
Optimized to minimize memory usage.
Missing Features¶
Unused
# type: ignorecomments are not yet reported.General plugin support is not planned; however, targeted plugins for popular libraries, such as Django, will be provided.
Function bodies using bounded TypeVar definitions (e.g.,
TypeVar("T", str, bytes)) are not currently type-checked. This limitation is unlikely to affect most users.