Mypy vs Pyright
Mypy vs Pyright compared for 2026: mypy 2.4 (MIT, plugin system, native parser, parallel checking, daemon) vs Pyright 1.1.414 (MIT, Node-based, lazy evaluator, language server behind Pylance). Includes a run we did on the same code with both: what each catches by default, return-type inference, timings on the rich library, memory, strictness modes, CI setup and a clear pick per situation.
Quick Answer
Mypy and Pyright are the two established static type checkers for Python, and both are free and MIT-licensed. Mypy 2.4.1 (28 October 2026) is the reference checker from the python organisation on GitHub: written in Python and compiled with mypyc, it has a plugin system that Django, Pydantic and other dynamic libraries rely on, a daemon for fast re-checks, and since 2.4 a Ruff-based native parser and non-experimental parallel checking. Pyright 1.1.414 (9 September 2026) is Microsoft's checker, written in TypeScript and run on Node; it infers return types, checks unannotated code by default and is the engine inside the Pylance VS Code extension. In our run on 19 November 2026, Pyright caught a bug in an unannotated function that mypy skipped even with --check-untyped-defs, while mypy finished the 78-file rich library in 1.8 seconds cold and 0.14 seconds warm against Pyright's 6.6 seconds. Pick mypy if you depend on plugins or want the CPython-community default in CI; pick Pyright if you want editor and CLI to agree and want more checking of untyped code out of the box.
Last updated November 19, 2026. Covers mypy 2.4.1 (28 October 2026) with the 2.0, 2.2 and 2.4 release notes and current docs, and Pyright 1.1.414 (9 September 2026) with its docs and mypy comparison page, all read on 19 November 2026, plus a side-by-side run we did the same day on a test file and on rich 14.1.0.
| Feature | Mypy | Pyright |
|---|---|---|
| Licence & Maintainer | MIT (copyright Jukka Lehtosalo, contributors and Dropbox); python/mypy on GitHub, ~20.7k stars | MIT (Microsoft); microsoft/pyright on GitHub, ~15.8k stars; Pylance is closed source |
| Written In / Runtime | Python, compiled to C extensions with mypyc; runs on Python 3.10+ | TypeScript on Node.js (contributors use Node 24) |
| Install | pip install mypy (or uv, pipx); WASM wheel experimental for Python 3.14 | npm install -g pyright, or pip install pyright (community wrapper that fetches Node) |
| Latest Release (Nov 2026) | 2.4.1 on 28 Oct 2026 (2.4.0 on 1 Oct 2026) | 1.1.414 on 9 Sep 2026 (same version on npm and PyPI on 19 Nov 2026) |
| Unannotated Functions | Skipped by default; --check-untyped-defs checks bodies but parameters stay Any | Checked by default; --skipunannotated to opt out |
| Return Type Inference | None: missing return annotation means Any | Yes, from return and yield statements; also some parameter inference |
| Merging Types (Join vs Union) | Mostly joins historically; 2.4.1 revealed str | int for the isinstance example in our run | Always unions; literal types kept for tuples and narrowed assignments |
| Strictness Presets | --strict bundle of flags plus per-module overrides; no named presets | typeCheckingMode off / basic / standard (default) / strict, plus per-rule overrides |
| Plugin System | Yes: e.g. mypy_django_plugin from django-stubs, Pydantic's mypy plugin | No, by design (maintainers cite latency, security and maintenance); django-stubs lists Pyright as basic support |
| Parser & Syntax Errors | Native parser (based on Ruff's) default since 2.4; legacy ast parser via --no-native-parser until early 2027 | Own parser that recovers from syntax errors |
| Re-check Speed | On-disk cache (.mypy_cache) and dmypy daemon | Watch mode (-w) and the language server re-check only changed files |
| Parallel Checking | -n N or -n auto (capped at 8); no longer experimental since 2.4; up to 5x with 8 workers per the release notes | --threads N, documented as experimental |
| Editor / Language Server | Via editor extensions and dmypy; no built-in language server | Language server: Pylance (VS Code), coc-pyright, ALE, LSP-pyright, lsp-pyright/eglot, PyCharm |
| Configuration | mypy.ini, setup.cfg or [tool.mypy] in pyproject.toml; inline # mypy: comments | pyrightconfig.json or [tool.pyright] in pyproject.toml; execution environments per subdirectory |
| Suppression Comments | # type: ignore[code], with error codes and --warn-unused-ignores | # type: ignore and # pyright: ignore[rule]; reportUnnecessaryTypeIgnoreComment |
| Output Formats | Text, -O json, --junit-xml, HTML coverage reports via mypy[reports] (reports not available with parallel workers) | Text or --outputjson (diagnostics with rule names and ranges); exit codes 0-4 |
| CI Integration | Any CI with Python; --junit-xml for CI test views; restore .mypy_cache between runs | jakebailey/pyright-action, pyright-to-gitlab-ci, MegaLinter, pre-commit via pyright-python |
| Stub Tooling | stubgen (generate) and stubtest (verify stubs against runtime) | --createstub for third-party imports; --verifytypes for py.typed packages |
| Python Versions Targeted | Targets 3.10 and newer since 2.0; 2.4 supports Python 3.15 features incl. PEP 661 and PEP 810 | Any 3.x via --pythonversion; bundles typeshed stdlib stubs |
| Our Run: rich 14.1.0 (78 files) | 2 errors, 1.76 s cold / 0.14 s warm, ~142 MB peak | 45 errors + 5 warnings (standard), 6.6 s, ~342 MB peak |
Mypy
Mypy is the original static type checker for Python, started by Jukka Lehtosalo in 2012 and developed under the python organisation on GitHub. It reads PEP 484 annotations and reports type errors, is compiled with its own mypyc compiler for speed, and ships the dmypy daemon, stubgen and stubtest. Mypy 2.x changed several defaults, made a Ruff-based native parser the default and turned parallel checking into a supported feature.
Pros
- Plugin system: django-stubs ships a custom mypy plugin (full support) and Pydantic maintains one, so framework magic type-checks
- Fast on our test: 1.76 s cold and 0.14 s with a warm cache for 26,700 lines, about 142 MB peak memory
- Gradual by default: unannotated functions are skipped, so you can adopt it on a large untyped codebase without a flood of errors
- Ships stubgen and stubtest for writing and validating stub files, plus a Python API (mypy.api.run)
- dmypy daemon keeps state in memory; the docs say re-checks can be 10 or more times faster
- pip install mypy: no Node.js or other runtime needed
Cons
- Never infers return types: an unannotated function returns Any, so callers are not checked against it
- Skipped a real bug in our unannotated test function, even with --check-untyped-defs
- No language server of its own; editor support comes through extensions that run the CLI or daemon
- Mypy 2.0 enabled --local-partial-types and --strict-bytes by default, so upgrades from 1.x can need small code changes
- Parallel mode does not support report generation, and the changelog notes minor semantic differences from sequential mode
Best For
Teams that rely on mypy plugins (Django via django-stubs, Pydantic), projects adopting types gradually on a large untyped codebase, and CI pipelines that want a pure-Python checker with a warm cache.
Pyright
Pyright is a static type checker and language server for Python built by Microsoft. It is written in TypeScript, runs on Node.js, and uses a lazy, just-in-time type evaluator with its own error-tolerant parser so it can answer editor queries on incomplete code. The same engine powers Pylance, the closed-source default Python language server in VS Code; the open-source CLI and server are MIT-licensed.
Pros
- Checks unannotated code by default and infers return types, so it finds bugs in untyped functions
- Same engine in the editor (Pylance, coc-pyright, LSP-pyright, PyCharm, Emacs) and in CI, so results match
- Named presets off / basic / standard / strict, plus per-rule severity and per-file # pyright: strict
- Keeps narrower types: literal tuples, literal math, unions instead of joins
- Error-tolerant parser keeps analysing after a syntax error, which helps while typing
- --outputjson, --verifytypes for library authors and a GitLab code-quality converter
Cons
- Needs Node.js; the PyPI package is a community wrapper that downloads Node and the npm package
- No plugin system by design; libraries must express their behaviour in standard typing features
- Slower than mypy on our run: 6.6 s for rich (5.2 s in the check phase) and about 342 MB peak
- A codebase that is clean under mypy can show dozens of new errors: 45 on rich in standard mode, 243 in strict
- Pylance, the richer VS Code extension built on it, is not open source
Best For
Teams that want the editor and CI to report the same errors, codebases with many unannotated helpers, VS Code and Neovim users, and library authors checking type completeness with --verifytypes.
Two designs: a multi-pass checker and a lazy language-server engine
Mypy is a traditional multi-pass analyser. It parses each module, runs semantic analysis top to bottom until types converge, then checks function bodies. That design is why mypy can resolve some circular references Pyright rejects (a class used in its own metaclass's type argument, a TypeVar bound to the class being defined), and why value-constrained TypeVars are checked once per constraint. Pyright was built to answer editor questions while you type: it evaluates the type of any identifier on demand, recursing only into what that identifier depends on, and it uses its own parser that keeps going after a syntax error. Mypy 2.4 narrowed one old gap by switching to a native parser based on Ruff's: it is faster, lets you target a newer Python than the one mypy runs on, and is required for parallel checking. The legacy parser stays available behind --no-native-parser until its planned removal in early 2027, and the native parser ignores type comments on for and with statements. The practical result: Pyright is the better engine for an editor, mypy has more room for plugins and multi-pass tricks, and both now run on modern syntax regardless of the interpreter you use for the tool.
What each catches by default, and why rich is clean in one and not the other
The biggest day-one difference is unannotated code. Mypy skips the body of any function without annotations unless you pass --check-untyped-defs, and even then untyped parameters are Any, and it never infers return types. Pyright checks every function and infers return types, so a caller of an unannotated helper is still checked. In our run, a helper that did sum(prices) + "0" passed mypy in both modes and failed Pyright with reportOperatorIssue. Pyright also keeps narrower types: it inferred Literal[1, 'one'] for an unannotated function where mypy said Any, and Literal['stop'] for a tuple element where mypy said str. The reverse also happens. Mypy flags calling a function declared to return None and using the result; Pyright does not. Mypy plugins can make framework code pass that Pyright cannot type. And each tool's own defaults matter: the rich library is maintained against mypy --strict and showed 2 mypy errors, while Pyright in its default standard mode reported 45 errors and 5 warnings, among them attribute access on Windows-specific modules, argument types and seven possibly unbound variables. Neither result is wrong. They are different rule sets, which is why switching checkers on an existing codebase is a project, not a flag.
Speed and memory: the old story needs updating
Pyright's documentation says it is often 3x to 5x faster than mypy on large code bases. That comparison predates mypyc-compiled wheels getting better, the 2.4 native parser and parallel checking, and our single run did not reproduce it. On a 2-vCPU cloud sandbox on 19 November 2026, checking rich 14.1.0 (78 files, 26,700 lines) took mypy 2.4.1 1.76 seconds with caching off and 0.14 seconds on a re-run with the cache warm; Pyright 1.1.414 took 6.6 seconds, of which its --stats output attributed 5.18 seconds to the check phase and about 1.1 seconds to tokenising, parsing and binding. Peak resident memory was about 142 MB for mypy and about 342 MB for Pyright's process tree. Two workers (-n 2) did not help mypy on this size and core count. One library on one machine is not a benchmark: large monorepos, heavy generics and Pyright's watch mode or language server can change the picture, and Pyright publishes its own weekly benchmark. Treat this as evidence that mypy is no longer the slow option by default, then measure on your repository. For re-checks during development, compare dmypy against Pyright's watch mode rather than cold CLI runs.
Configuration, strictness and adopting either on an existing codebase
Mypy reads mypy.ini, setup.cfg or [tool.mypy] in pyproject.toml. --strict switches on a bundle of checks, and [[tool.mypy.overrides]] lets you relax or tighten per module, which is how most large codebases ratchet up. The mypy docs recommend starting on a 5,000 to 50,000 line subset, pinning the mypy version and adding the run to CI before adding annotations. Mypy 2.0 made --local-partial-types and --strict-bytes default and changed --allow-redefinition to the more flexible new behaviour (the old one is --allow-redefinition-old), so pin and read the release notes when upgrading from 1.x. Pyright reads pyrightconfig.json or [tool.pyright]. typeCheckingMode picks off, basic, standard (the default) or strict, and every diagnostic rule can be set to none, information, warning or error; strict paths can be listed so new packages start strict while old ones stay at standard. Execution environments let one config check subdirectories with different Python versions or search paths. Both honour # type: ignore; Pyright adds # pyright: ignore[rule] and both can report suppressions that are no longer needed. If you migrate, run the new checker in CI as non-blocking for a while and burn down by rule, not by file.
Editors, CI and the wider checker landscape
Pyright is a language server first: in VS Code most people get it through Pylance, which Microsoft ships with the Python extension and which adds features such as semantic highlighting on top; Pylance's code is not open source. Neovim, Sublime, Emacs and PyCharm can run the open-source Pyright server directly. Mypy has no server of its own, so editor integrations run the CLI or dmypy and are usually slower to update while you type. In CI both are one command. Mypy needs only Python and benefits from caching .mypy_cache between runs. Pyright needs Node; the community pyright-action pins a version, pyright-to-gitlab-ci turns --outputjson into a GitLab code-quality report, and the PyPI pyright package (also community-maintained) downloads Node for you, which can surprise locked-down runners. There are newer options too: Astral's ty (0.0.107, marked beta on PyPI), pyrefly (1.5.0) and the basedpyright fork (1.40.2). We did not test them for this page, so we make no claims about them beyond their existence. If you lint with Ruff already, see our Ruff vs Black vs Flake8 comparison for how linting and type checking split the work.
Verdict
Pick mypy when your code depends on a library that needs a mypy plugin (Django with django-stubs, Pydantic's plugin, other metaprogramming-heavy frameworks), when you are adding types to a large untyped codebase and want to start with zero noise, or when your CI is Python-only and you would rather not install Node. With 2.4 the old speed argument has mostly gone: in our run mypy was the faster CLI on a mid-sized library, and a warm cache made re-checks near-instant. Turn on --check-untyped-defs early, and move modules to --strict as they get annotated. Pick Pyright when most developers already use VS Code (Pylance) or another LSP editor and you want CI to report exactly what the editor shows, when much of the code is unannotated and you want it checked anyway, or when you publish a library and want --verifytypes. Start in standard mode and use strict per directory. Running both is reasonable for libraries that want to work for users of either checker, but expect real disagreements: rich passes mypy --strict with 2 errors and shows 45 in Pyright's default mode. If you are choosing for a new project with no plugin dependency, Pyright's defaults catch more with less configuration; if you are inheriting a mypy setup that works, there is no strong reason to switch.