What changes when you switch from mypy or Pyright to Astral ty?
Astral, the company behind uv and Ruff, released ty 1.0 on December 1, 2026. ty is a Python type checker and language server written in Rust, and Astral now recommends it for production use. Before ty replaces a mypy or Pyright job in CI, it has to catch the mistakes that job blocks today.
All three checkers ran on one test file. ty caught a string assigned to an int variable that mypy skipped by default, but missed a call to .upper() on an integer that Pyright caught. The differences start with the checkers' defaults and extend to framework code, where ty has built-in support for Django and Pydantic and mypy can use plugins. Running ty as a second CI job can surface those gaps before you switch, and its preview baseline lets you defer existing diagnostics.
Which errors change under the defaults?
The test file below has a bad assignment in one function and an invalid call on the return value of another. Each checker ran with its default settings.
def body():
count: int = "two"
return count
def count_items():
return 3
count_items().upper()
| Checker | Assigning a string to count |
Calling .upper() on the result |
|---|---|---|
| mypy 2.4.1 | No error. It prints a note about unchecked annotations. | No error |
| Pyright 1.1.414 | Assignment error | Attribute access error |
| ty 1.0.0 | Assignment error | No error |
mypy's default skips the bodies of fully unannotated functions, so mypy reports no assignment error here. ty checks those bodies by default and catches the assignment. Pyright infers return types from the function body, which is how it catches the call to .upper(). In ty, return type inference for unannotated functions is opt-in. With analysis.return-type-inference="always", ty reports both errors in the example. Astral notes that the setting does not yet infer return types for generator or async functions.
You can also make the contract explicit by declaring count_items() -> int. When reviewing a discrepancy in real code, check whether the function's annotation is missing before changing a setting for the entire project.
What happens to framework checks?
The example above uses plain Python. In framework code, some diagnostics come from plugins listed in your mypy configuration. ty has built-in support for selected libraries and lacks a mypy-style plugin system. Test the specific checks you depend on, even when ty lists the framework as supported.
Django model inference requires the django-types stub package. With those stubs installed, ty can infer types for model fields and forward foreign keys, and uses an explicit annotation such as models.ForeignKey[Book] to resolve string references like ForeignKey("Book", ...). Astral documents gaps for reverse relationship attributes. ty skips field names in model constructors and queries, so keep your current checker if it catches invalid query fields.
Astral plans to support django-stubs. For now, the two packages have conflicting stub files, so if mypy uses django-stubs, give the ty job its own environment with django-types as its only Django stub package.
In Pydantic v2, ty understands that an integer field can accept a string at construction in lax mode. Make the field strict and ty flags the string. Its docs also say it does not check a model_validate dictionary field by field and does not fully model the inputs custom validators accept. When comparing checkers, include both direct constructor calls and request or configuration dictionaries passed to model_validate.
How do you find lost coverage before switching CI?
The example used one file. To see where the checkers differ across your codebase, run ty as a second CI job while the existing check stays required. Pin both versions and run them on the same revision with the same Python target, source paths and compatible dependencies. Keep both jobs' output visible and match diagnostics by file, line and the problem described, since rule names differ between checkers.
Astral's rule mapping table shows which checks have a ty or Ruff equivalent and where gaps remain. ty has no equivalent yet for mypy's no-untyped-call or for the match-exhaustiveness checks exhaustive-match (mypy) and reportMatchNotExhaustive (Pyright). For mypy's no-untyped-def, which flags functions missing annotations, Astral points to Ruff's ANN rules. Use the mapping to look up the rules enabled in your mypy or Pyright configuration.
Severity matters too. By default, ty exits with status 1 on warnings, so a warning about an extra Pydantic constructor argument fails the parallel job just as an error would.
A diagnostic that only your current checker reports points to a check you could lose in the switch. On a scratch branch, reintroduce a type error that originally justified a project rule or a framework plugin, then see whether both jobs fail. A reintroduced error can expose a gap even when both checkers pass on the main branch.
Existing suppressions can also affect the comparison. ty honors # type: ignore comments by default, so a separate run with analysis.respect-type-ignore-comments=false shows the diagnostics those comments suppress.
When should you use a diagnostic baseline?
Once you've reviewed what ty catches, a baseline can keep an existing backlog from blocking new changes. Set baseline = "ty-baseline.json" under [tool.ty] in pyproject.toml and run ty check --update-baseline. Commit the generated file so ordinary ty check runs in CI can report newly introduced diagnostics. Astral's baseline configuration marks the feature as preview and says the file format may change between releases. To suppress existing diagnostics in the code, use ty check --add-ignore to add # ty: ignore[rule] comments in one pass.
In a one-file test with ty 1.0.0, a function annotated -> int returned a string. After ty check --update-baseline saved the diagnostic, the next ty check passed. Calling the function with an argument it doesn't accept produced a new error and exit status 1, while the saved return-type error stayed suppressed.
Which module should you try first?
For a first trial, pick the module where your current checker does the most project-specific work. Exercise the plugin behavior and custom rules you depend on in that module. If ty catches the mistakes that job exists to block, you have a candidate for switching CI. If a plugin or an inferred return type accounts for a check you still need, keep the existing job required until you've covered that case.
Member discussion