# ty vs mypy, and how to switch without fixing old errors

> ty 1.0 is faster than mypy and stricter by default; a baseline file lets CI fail only on new type errors.

Source: https://fullbytedeveloper.com/blog/ty-vs-mypy-switch-with-baseline
Published here: 2026-12-02

ty is Astral's Python type checker written in Rust, and 1.0 shipped on 2026-12-01 as a faster, stricter alternative to mypy. [1] On the Python typing conformance suite it records 14 false positives and 13 false negatives against mypy's 190 and 109, and OpenAI's move to ty gave a median 24x speedup with 73% less peak memory, per Astral. [1]

The catch for a big codebase is the first run. ty checks the bodies of unannotated functions by default, which mypy skips unless you turn on `check_untyped_defs`, so expect more errors on day one. [4] A baseline file records those errors so CI only fails on new ones.

Related reading: [race uv against pip on a cold cache install](/blog/uv-pip-cold-cache-install-race), [update Python tooling after the eMudhra certificate incident](/blog/python-emudhra-certificate-update) and [save GitHub Actions minutes with three workflow fixes](/blog/ci-minutes). Browse the [Dev tools topic](https://fullbytedeveloper.com/blog/topic/dev-tools).

## Install ty and run it once

Astral's installation guide documents a global install with uv. [2]

```bash
uv tool install ty@latest
```

Run the checker from the project root. [1]

```bash
ty check
```

By default ty exits with code 1 if it reports any warning or error, which is what makes it fail a CI job. [3] To pin one version for the whole team instead, the docs add it as a dev dependency with `uv add --dev ty` and run it with `uv run ty`. [2]

## Record today's errors in a baseline file

Point ty at a baseline file in `pyproject.toml`. The path is resolved against the project root. [3]

```toml title="pyproject.toml"
[tool.ty]
baseline = "ty-baseline.json"
```

**Warning:** diagnostic baselines are in preview, and the docs say the file format may change between ty releases. [3] Regenerate the file after you upgrade ty.

Write the current diagnostics into it. [3]

```bash
ty check --update-baseline
```

Commit `ty-baseline.json`. Astral's example shows the next `ty check` passing, while a new error in the same file still fails it. [1]

```text
All checks passed!
```

If you prefer suppression comments to a separate file, `ty check --add-ignore` adds them to the code in one pass. [1]

## Translate your mypy settings

The migration guide maps mypy's settings to ty. [4]

- A line ignore such as `# type: ignore[code]` becomes `# ty: ignore[rule]`.
- `disable_error_code` becomes `<rule> = "ignore"` under `[tool.ty.rules]`.
- Severities are `ignore`, `warn` and `error`.

The configuration reference shows the rules table. [3]

```toml title="pyproject.toml"
[tool.ty.rules]
possibly-unresolved-reference = "warn"
division-by-zero = "ignore"
```

ty has no mypy plugins. It ships built-in support for Pydantic, Django, pytest and attrs, and the guide says several mypy and Pyright checks are not implemented in ty yet, so check its rule mapping table for the codes you rely on. [1][4]

## Let ty fix what it can

ty 1.0 applies its suggested fixes, such as removing a redundant `cast`, with one flag. [1]

```bash
ty check --fix
```

Astral's example reports `Found 1 diagnostic (1 fixed, 0 remaining).` before the next check passes. [1] Review the diff like any other change before you commit it.

You now have ty installed, today's errors parked in a committed baseline, your mypy ignores translated, and a CI check that fails only when someone adds a new type error.

Send this to the Python teammate who keeps putting off the mypy upgrade.

## Sources

1. [Astral: ty 1.0](https://astral.sh/blog/ty-1.0)
2. [ty docs: installation](https://docs.astral.sh/ty/installation/)
3. [ty docs: configuration reference, baseline](https://docs.astral.sh/ty/reference/configuration/#baseline)
4. [ty docs: coming from mypy or pyright](https://docs.astral.sh/ty/coming-from-mypy-or-pyright/)
