DevelopmentNov 19, 2026By Rivalivo Editorial

Python type checkers in 2026: mypy vs Pyright vs basedpyright vs Pyrefly vs ty

Compare mypy, Pyright, basedpyright, Pyrefly and ty for Python type checking, gradual adoption, editor integration and configuration boundaries.

Five translucent code-shaped blocks pass through a forest-green measuring frame with cobalt alignment guides on ivory stone.

A Python function can accept the wrong object long before a failing request exposes the mistake. Static type checking brings some of those disagreements into the editor and build process, using annotations and inference to compare the values your code produces with the contracts other code expects.

mypy, Pyright, basedpyright, Pyrefly and ty all address that problem, but their defaults, configuration models and editor experiences differ. The useful choice is the checker your team can run consistently against its real dependencies, with errors people understand and a practical route toward stronger coverage. This comparison uses current official documentation, rather than a benchmark performed on a sample project.

What a type checker should establish

Type analysis does not execute the application or validate every external payload. It also cannot recover precise information that has been discarded behind an unconstrained dynamic value. Start by deciding which modules and Python versions the checker should understand, which dependencies supply useful typing information, and which diagnostics should block a change.

Environment selection is part of that decision. The Python project manager comparison covers repeatable dependency environments. A checker should analyze the environment used by the application, rather than accidentally resolving a different installed package.

The quick difference

Product Useful fit Important boundary
mypy Gradual adoption with detailed per-module controls Untyped code and missing imports can conceal gaps
Pyright CLI and editor analysis with explicit environments Project modes and editor settings need alignment
basedpyright Pyright-derived analysis with stronger defaults Additional diagnostics require a deliberate rollout
Pyrefly Type analysis and language-server workflows Migration and unconfigured-project behavior matter
ty Rust-based checking and integrated editor features Check library support and rule configuration directly

mypy

mypy provides a detailed path for adding checks to an existing Python codebase. Its documentation recommends beginning with a manageable scope, checking consistently and gradually tightening rules. Per-module configuration helps a team apply stronger expectations to maintained code without demanding that every legacy file be annotated immediately.

That flexibility needs ownership. Broadly ignoring missing imports can replace useful information with permissive types, while an unannotated function may receive less checking than its author expects. The documentation distinguishes these situations and describes options for checking function bodies, requiring annotations and identifying unused suppressions. mypy also has an extension mechanism for integrations that need specialized analysis.

Choose mypy when incremental policy and an established typing workflow are central. Evaluate a representative framework model, decorator and third-party import before deciding the configuration is complete. A clean result should mean the intended modules were analyzed under the intended rules, rather than that several difficult areas were silently excluded.

Pyright

Pyright combines a command-line checker with editor tooling and a configuration model for project files, Python versions, platforms and execution environments. Its current configuration documentation lists off, basic, standard and strict modes, with standard as the documented default. Individual diagnostic levels can be adjusted separately.

This makes it useful when developers want responsive feedback while editing and a corresponding command in CI. The configuration still needs to identify source roots, imports and the target runtime correctly. Excluding a path from the initial project selection is not necessarily the same as suppressing diagnostics for code reached through imports.

Choose Pyright for a team comfortable making those settings explicit. Compare the CLI result with the editor using the same source revision and environment. Also distinguish the open-source Pyright project from separately packaged editor products: availability of a language-server feature in another product should not be assumed from a reference to the same underlying checker.

basedpyright

basedpyright builds on Pyright while changing defaults and adding diagnostics and workflow features. Its documentation describes a recommended checking mode with broader checks, reporting that affects command-line failure behavior, and a platform default that considers all operating systems. It also documents automatic discovery of a project-local .venv in the relevant default configuration.

The benefit is less initial configuration for teams that want a stronger starting policy. The cost is that a migration can expose many more findings than an existing Pyright setup. Treat that as a policy change to review, rather than automatically calling every additional message a newly introduced application defect.

Choose basedpyright when its specific rules and defaults match your team’s expectations. Review one diagnostic family at a time, document justified exceptions and ensure that local editor settings do not dilute the CI policy. Its relationship to Pyright makes comparison useful, but does not make every release or configuration choice interchangeable.

Pyrefly

Pyrefly supplies both type checking and a Python language server. Current documentation covers editor integration, import resolution and migration from existing checker configurations. It supports dedicated pyrefly.toml configuration or a tool.pyrefly section in pyproject.toml, so policy can live with the project.

A particularly important current boundary is unconfigured behavior. The documentation says Pyrefly can synthesize configuration from nearby mypy or Pyright-related settings; without a usable migrated configuration it selects a basic preset that limits diagnostics. Running a command successfully is therefore not enough to establish that the desired type policy was applied.

Choose Pyrefly when its editor workflow and migration approach fit the repository. Initialize and review the effective configuration, then compare findings on intentional errors and known valid patterns. Older searches may surface Pyre, whose repository is archived and points type-checking users to Pyrefly. Existing Pyre configuration should be assessed as a migration, rather than treated as a current interchangeable installation guide.

ty

ty is Astral’s Rust-based Python checker and language server. Its documentation describes contextual diagnostics, configurable rule levels, per-file overrides and editor functions such as navigation, completions and code actions. The command-line entry point checks project files, while its configuration reference explains how to set the analysis environment.

The appeal is a combined checking and editor experience from the team behind related Python tooling. Evaluate that experience using your actual libraries. Current documentation has dedicated guidance for third-party ecosystems, so confirm the particular framework behavior you depend on rather than assuming every dynamic construct is understood equally.

Choose ty if its diagnostics and integration make typing easier to maintain. Vendor speed claims are not a substitute for measuring the repository and hardware you use. Record the checker version and settings before comparing results, especially when assessing a migration from another tool with different inference, suppression and error-severity conventions.

How to choose and introduce a checker

Prepare a small evaluation set from real code: a typed public function, a partially typed module, an imported dependency, a decorator and one deliberately incompatible call. Ask each checker to explain the error and identify where useful information was lost. Count the findings that developers can act on, rather than selecting whichever produces the longest list.

Establish a shared environment and a checked-in configuration before enforcing a build gate. The Python version being analyzed can differ from the interpreter running a tool, so record both. Include operating-system assumptions if the application has platform-specific branches. A result obtained only on one developer’s laptop is difficult to reproduce.

Plan a gradual adoption boundary. Require annotations at stable interfaces first, make suppressions specific and give each exception an owner. Periodically remove suppressions that no longer apply. Avoid running two checkers indefinitely without deciding which result defines policy, since incompatible expectations can turn a useful safeguard into recurring annotation work.

These projects can be used locally rather than as metered hosted analysis services. There is no comparable per-request subscription to normalize here; implementation cost comes from CI resources, integration and maintaining typing information. Review the applicable project licenses when redistributing tooling.

Selection checklist

  • Confirm imports, source roots, Python version and platform assumptions.
  • Compare editor and CI results under the same configuration.
  • Include typed, untyped and framework-heavy code in the evaluation.
  • Review default modes, exclusions and suppression behavior.
  • Assign ownership for upgrades and existing error reduction.

Which checker fits your project?

mypy is a practical starting point for carefully staged adoption. Pyright suits explicit CLI and editor configuration, while basedpyright offers a more opinionated related policy. Pyrefly deserves evaluation for its language-server and migration workflow, and ty for its integrated Astral tooling approach. Choose after checking meaningful examples from your repository. No checker replaces runtime validation, tests or review of the assumptions expressed in annotations.

References