Skip to content

ty 1.0 Migration Guide: Move from mypy to ty and Fix the type: ignore Comments That Stop Working

Updated on

ty 1.0.0 (December 1, 2026) is Astral's Rust type checker. Tested against mypy 2.4.1 on a pandas and Pydantic project: why # type: ignore[arg-type] no longer suppresses anything, the [tool.mypy] to [tool.ty] translation table, --fix vs --add-ignore vs a baseline, the exit code that fails CI on warnings, and the renamed-rule warnings after upgrading from the beta.

The short answer: ty 1.0.0 was released on December 1, 2026. It is the type checker from Astral, the team behind uv and Ruff. Add it next to mypy and run it once before you change anything:

uv add --dev "ty>=1.0,<1.1"
uv run ty check

On an existing mypy project, expect four things on that first run:

  1. More diagnostics than mypy shows. Our four-file sample went from 4 mypy errors to 8 ty diagnostics. rich, which has 1 error under mypy --strict, produced 42.
  2. Your # type: ignore[arg-type] comments stop working. ty ignores mypy error codes inside the brackets, so those lines are reported again. A bare # type: ignore still works.
  3. ty does not read [tool.mypy]. ignore_missing_imports, disable_error_code and plugins all need a [tool.ty] equivalent. The table is below.
  4. Warnings fail CI. ty check exits with code 1 when it finds only warnings.

None of this needs a big-bang rewrite. ty check --fix, ty check --add-ignore and a baseline file get a legacy project to a passing check, and you can keep mypy running during the switch.

What was tested: every item marked "tested" was run on December 2, 2026, on an Apple M4 Max (macOS 26.5) in a uv virtual environment with CPython 3.13, ty 1.0.0, mypy 2.4.1, pandas 3.1.2, pandas-stubs 3.1.0.261029, NumPy 2.5.5 and Pydantic. Pyright itself, the VS Code extension, the Django, attrs and pytest support, Windows and Linux were not tested; those parts come from the official docs (opens in a new tab) and are marked as such. Performance and conformance numbers quoted from Astral are labeled as vendor numbers.

mypy to ty at a glance

You have in mypyWhat to do in tyTested
# type: ignore[arg-type]Add # ty: ignore[invalid-argument-type] (or run --add-ignore)Yes
# type: ignore (bare)Nothing, it still suppresses the lineYes
ignore_missing_imports = true for a moduleallowed-unresolved-imports = ["pkg.**"] under [tool.ty.analysis]Yes
disable_error_code = ["..."]<rule> = "ignore" under [tool.ty.rules] (rule levels tested with "warn")Yes
plugins = ["pydantic.mypy"]Remove it; Pydantic support is built inYes
warn_unused_ignores = trueOn by default (unused-type-ignore-comment, unused-ignore-comment)Yes
check_untyped_defs = trueNothing; ty always checks unannotated function bodiesDocs
--strictNo flag; enable four extra rules (see Step 6)Docs
Other mypy pluginsNo equivalentDocs
python_version = "3.13"python-version = "3.13" under [tool.ty.environment], or let ty read requires-pythonYes
Trending reads

Step 1: Install ty next to mypy

ty ships as a single binary on PyPI. Pick the form that matches how you run tools:

# as a dev dependency of the project (what we tested)
uv add --dev "ty>=1.0,<1.1"
 
# as a global tool
uv tool install ty@latest
 
# one-off, without installing
uvx ty@1.0.0 check

Pin the minor version in CI. The versioning policy (opens in a new tab) says patch releases contain bug fixes, while minor releases "may report new type errors". A range like >=1.0,<1.1 keeps a Monday-morning release from turning your pipeline red.

ty finds your environment on its own. In a uv project it uses .venv, and it reads the target Python version from requires-python in pyproject.toml. If your environment lives elsewhere, pass --python path/to/venv.

Step 2: Run both checkers and compare

Here is the sample we used. It is a small sales report package with pandas and Pydantic, and a mypy config that most data projects will recognize:

[tool.mypy]
python_version = "3.13"
plugins = ["pydantic.mypy"]
disable_error_code = ["import-untyped"]
warn_unused_ignores = true
 
[[tool.mypy.overrides]]
module = "legacy_vendor.*"
ignore_missing_imports = true

mypy reports 4 errors:

src/sales_report/models.py:13: error: Argument "dry_run" to "ReportOptions" has incompatible type "str"; expected "bool"  [arg-type]
src/sales_report/report.py:14: error: Argument 1 to "load_orders" has incompatible type "Path"; expected "str"  [arg-type]
src/sales_report/report.py:15: error: Argument "n" to "top_customers" has incompatible type "str"; expected "int"  [arg-type]
src/sales_report/report.py:17: error: Incompatible types in assignment (expression has type "str", variable has type "int")  [assignment]
Found 4 errors in 2 files (checked 4 source files)

ty, with no configuration, reports 8 (tested). The concise output format prints one line per diagnostic, which is easier to diff against mypy:

uv run ty check --output-format concise
src/sales_report/load.py:3:8: error[import-not-found] Cannot resolve imported module `legacy_vendor.client`
src/sales_report/load.py:23:12: error[invalid-explicit-return] Return type does not match returned value: expected `int`, found `int | None`
src/sales_report/load.py:27:12: error[unsupported-operator] Operator `+` is not supported between objects of type `Literal["order-"]` and `int`
src/sales_report/models.py:13:46: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `Literal["yes"]`
src/sales_report/report.py:14:22: error[invalid-argument-type] Argument to function `load_orders` is incorrect: Expected `str`, found `Path`
src/sales_report/report.py:15:30: error[invalid-argument-type] Argument to function `top_customers` is incorrect: Expected `int`, found `Literal["5"]`
src/sales_report/report.py:17:5: error[invalid-assignment] Object of type `Literal["many"]` is not assignable to attribute `rows` of type `int`
src/sales_report/report.py:19:13: warning[redundant-cast] Value is already of type `int`
Found 8 diagnostics

The four shared errors are the same bugs under new names. The four extra lines each have a different cause, and each one maps to a step below:

Extra ty diagnosticWhy mypy was quietFix
import-not-found on legacy_vendormypy had ignore_missing_importsStep 3
invalid-explicit-return on line 23The line has # type: ignore[return-value]Step 4
unsupported-operator on line 27The line has # type: ignore[operator]Step 4
redundant-cast warningmypy only reports this with warn_redundant_castsStep 5

Note the Pydantic line. dry_run is declared as Field(default=False, strict=True). The same model has an output: Path field, and the call fills it with the string "./exports". ty caught the string passed to dry_run with no plugin and no configuration, and it accepted output="./exports", which Pydantic converts to a Path. mypy 2.4.1 also reports dry_run without the plugin, but then it flags output as well (tested). The plugin exists to remove that kind of false positive, and ty does not need it.

Step 3: Translate [tool.mypy] to [tool.ty]

ty reads [tool.ty] in pyproject.toml or a separate ty.toml. It never reads mypy or Pyright configuration. This is the translation of the config above (tested):

[tool.ty.environment]
python-version = "3.13"
 
[tool.ty.analysis]
# mypy: [[tool.mypy.overrides]] module = "legacy_vendor.*", ignore_missing_imports = true
allowed-unresolved-imports = ["legacy_vendor.**"]
 
[tool.ty.rules]
# "ignore" disables a rule, like mypy's disable_error_code
redundant-cast = "warn"
 
# per-directory rule levels, like mypy overrides
[[tool.ty.overrides]]
include = ["tests/**"]
 
[tool.ty.overrides.rules]
invalid-argument-type = "warn"

A few differences to keep in mind:

  • Glob syntax. legacy_vendor.* matches one level. legacy_vendor.** matches the package and everything under it, which is what mypy's legacy_vendor.* meant.
  • Three severities. A rule is "ignore", "warn" or "error". There is no "note" or "information" level.
  • Untyped libraries. allowed-unresolved-imports silences the import error only. If a library resolves but its types cause noise, replace-imports-with-any = ["somepkg.**"] treats the whole module as Any (from the docs, not tested).
  • Rule names. The official mypy and Pyright mapping table (opens in a new tab) lists every mypy error code with its ty rule. The ones you will need most:
mypy codety rule
arg-typeinvalid-argument-type
assignmentinvalid-assignment
return-valueinvalid-explicit-return
attr-definedmissing-attribute
union-attrmissing-union-attribute (or missing-attribute when every member lacks it)
call-argmissing-argument
operatorunsupported-operator
import-not-foundimport-not-found
overrideincompatible-method-override

After adding the config, the import-not-found error is gone and the sample is down to 7 diagnostics.

Step 4: Fix the type: ignore comments that stopped working

This is the least obvious change. ty supports the standard # type: ignore comment, but it handles the bracketed codes differently:

CommentSuppresses in ty 1.0?
# type: ignoreYes, everything on the line
# type: ignore[arg-type]No. Codes without a ty: prefix are ignored
# type: ignore[ty:invalid-argument-type]Yes, that rule only
# ty: ignore[invalid-argument-type]Yes, that rule only
# pyright: ignore[reportArgumentType]No

All five rows were tested. The consequence: if your team followed good mypy practice and always wrote the error code, every one of those suppressions is inactive under ty. rich has 22 # type: ignore[...] comments and all 22 carry a code.

You have two ways to write a suppression that both checkers accept.

Option A, one combined comment. The ty docs show this form:

return int(raw) if raw else None  # type: ignore[return-value, ty:invalid-explicit-return]

ty accepts it. But if mypy runs with warn_unused_ignores = true, mypy 2.4.1 complains about the part it does not know (tested):

src/sales_report/load.py:23: error: Unused "type: ignore[ty:invalid-explicit-return]" comment  [unused-ignore]

Option B, two comments. This is what --add-ignore writes, and both checkers stay quiet:

return "order-" + order_id  # type: ignore[operator]  # ty: ignore[unsupported-operator]

Use option B while both checkers run in CI. When mypy is gone, delete the # type: ignore[...] half.

Step 5: Get to green with --fix, --add-ignore, or a baseline

You rarely want to fix every finding on day one. ty 1.0 has three tools for that, and they combine well in this order.

5a. Apply the safe fixes

uv run ty check --fix

In our sample this removed the redundant cast and reported Found 7 diagnostics (1 fixed, 6 remaining). It also deletes bare # type: ignore comments that no longer suppress anything. Review the diff before committing.

5b. Suppress what is left, inline

uv run ty check --add-ignore
All checks passed!
Added 6 ignore comments

Each remaining diagnostic gets a # ty: ignore[rule] comment on its line. Lines that already had a mypy comment keep it and get the ty comment appended (tested). This is the fastest route, but it touches many files, so do it in its own commit.

5c. Or keep suppressions out of the code with a baseline

A baseline is a JSON file listing the existing diagnostics. ty skips anything recorded there and reports only new problems. It is a preview feature in 1.0, so the file format may change.

uv run ty check --update-baseline --baseline ty-baseline.json
Updated baseline `ty-baseline.json` with 6 diagnostics.

ty prints the absolute path of the file; it is shortened here.

Then point the config at it and commit the file:

[tool.ty]
baseline = "ty-baseline.json"

The file stores the rule and the column range per file, not the line number. We inserted three lines above a recorded error and the check still passed (tested).

Which one? Use --add-ignore when the count is small and you want each suppression visible in review. Use a baseline when there are hundreds of findings and you want to stop new ones first.

Step 6: Wire ty into CI

Three details matter here.

Exit codes. ty exits 1 on warnings, not only on errors (tested):

SituationExit code
No diagnostics0
Warnings only1
Warnings only, with --exit-zero-on-warning0
Any diagnostics, with --exit-zero0
Invalid options or configuration2 (docs)

If you want mypy-like behavior where only errors fail the build, add --exit-zero-on-warning.

Annotations. On GitHub Actions, the github output format turns each diagnostic into an inline annotation on the pull request:

- name: Type check
  run: uv run ty check --output-format github

It prints lines such as ::error title=ty (invalid-explicit-return),file=...,line=30,col=12 (tested). There are also gitlab, junit and sarif formats.

Strictness. ty has no --strict. Its defaults already include what mypy hides behind check_untyped_defs. The docs suggest this as the closest thing to strict mode (not tested here):

[tool.ty.rules]
dynamic-function-decorator-return = "error"
missing-type-argument = "error"
possibly-unresolved-reference = "warn"
unsound-return = "error"

There is no ty rule for "this function has no annotations" (mypy's disallow_untyped_defs). The docs point to Ruff's ANN rules for that.

Upgrading from the ty beta: renamed-rule

If your project adopted ty before 1.0, the upgrade can break CI without any change to your code. Several rules were renamed, and an old name in [tool.ty.rules] now produces a warning. Since warnings exit 1, the job fails.

We reproduced this on the seaborn repository, which already has a [tool.ty] section (commit of October 7, 2026, tested with ty 1.0.0):

pyproject.toml:117:1: warning[renamed-rule] Rule `invalid-method-override` has been renamed to `incompatible-method-override`
pyproject.toml:119:1: warning[renamed-rule] Rule `unresolved-attribute` has been renamed to `missing-attribute`
pyproject.toml:125:1: warning[renamed-rule] Rule `call-non-callable` has been renamed to `not-callable`
pyproject.toml:126:1: warning[renamed-rule] Rule `call-top-callable` has been renamed to `call-to-function-with-unknown-signature`
pyproject.toml:127:1: warning[renamed-rule] Rule `invalid-return-type` has been renamed to `invalid-explicit-return`

The fix is a rename in your config:

Old nameName in 1.0
invalid-method-overrideincompatible-method-override
unresolved-attributemissing-attribute
call-non-callablenot-callable
call-top-callablecall-to-function-with-unknown-signature
invalid-return-typeinvalid-explicit-return

These five are the ones this repository happened to use. Run ty check once after upgrading and it lists any others with the new name. Old names inside # ty: ignore[...] comments get their own warning, renamed-rule-in-ignore-comment, which also exits 1 (tested), so rename those too.

What changes for pandas and NumPy code

Data science code leans on libraries whose types are partial, so this is where the two checkers differ most. We ran a typical analysis module (read a CSV, group, aggregate, plot) through both.

Without pandas-stubs (tested):

  • mypy stops at the import: Library stubs not installed for "pandas" [import-untyped].
  • ty prints All checks passed!. It reads pandas directly and treats what it cannot infer as Unknown. That is quiet, but it also means a function that returns df["qty"].mean() from a -> int signature is not flagged.

With pandas-stubs installed (tested):

def top_region(df: pd.DataFrame) -> str:
    totals = df.groupby("region")["revenue"].sum()
    return totals.idxmax()          # both checkers: returns Hashable, not str
 
 
def bad(df: pd.DataFrame) -> int:
    return df["qty"].mean()         # mypy: float is not int. ty: no diagnostic
ty 1.0.0mypy 2.4.1
idxmax() returned as strReportedReported
mean() returned as intNot reportedReported
reveal_type(df["qty"].mean())Unknownfloat

So on pandas-heavy code, ty 1.0 is not strictly "more errors than mypy". It found more in plain Python and Pydantic code and less in one pandas-stubs case. If your project relies on mypy plus pandas-stubs to catch numeric return types, keep both checkers running for a while and compare before you delete mypy.

Install the stubs either way:

uv add --dev pandas-stubs

For typing DataFrames themselves, see our pandas typing guide.

How fast is it?

Speed is the headline claim, and it held up in a small local test. Both runs are uncached, on the rich source tree (100 files, 38,348 lines, commit of November 7, 2026):

CheckerWall timeResult
mypy 2.4.1 (--strict from the repo config, --cache-dir=/dev/null)0.59 s1 error
ty 1.0.0 (no config)0.03 – 0.04 s42 diagnostics

That is roughly 15x on a small project and one machine. It is not a benchmark. Astral's own numbers (vendor data, not verified here) say ty was the fastest checker on 16 of 18 projects in their CLI benchmark, and that OpenAI saw a median 24x speedup after migrating.

The 42 diagnostics matter more than the timing. Twenty of them sit on lines that already carry a coded # type: ignore[...] comment, which ty does not honor. Five are import-not-found for optional dependencies: four for IPython and ipywidgets, which the repo's mypy config ignores, and one for attr, which is also the single error mypy reports. The remaining 17 are findings mypy does not report. A project that is nearly clean under mypy --strict should still budget time for the first ty run.

Should you switch now?

Your situationRecommendation
New project, no checker yetStart with ty. One tool family with uv and Ruff, and no legacy comments to convert
mypy with only Pydantic's pluginGood candidate. Pydantic support is built in; follow steps 1 to 6
mypy with other plugins (SQLAlchemy, custom)Wait, or run ty alongside. There is no plugin system
Django, attrs, pytestBuilt-in support is listed in the 1.0 release notes; we did not test it
Heavy pandas-stubs usage in CIRun both for a few weeks and compare (see the pandas section)
Pyright or Pylance in VS CodeThe CLI migration is the same; # pyright: ignore comments need converting. The editor setup (opens in a new tab) is in the docs, not tested here
Already on the ty betaUpgrade and fix renamed-rule warnings

Type checkers find a class of bugs before the code runs. For the bugs that only show up with real data, a notebook is still where most analysis gets debugged. RunCell (opens in a new tab) puts an AI agent inside Jupyter that can run cells and read the actual DataFrame, which covers the part a static checker cannot see.

FAQ

Why does ty report errors on lines that have # type: ignore[arg-type]?

ty ignores codes inside the brackets unless they start with ty:. A mypy code suppresses nothing. Add # ty: ignore[invalid-argument-type] to the line, or run ty check --add-ignore to add the comments in one pass.

Does ty read my mypy or Pyright configuration?

No. Only [tool.ty] in pyproject.toml or a ty.toml file. Translate ignore_missing_imports to allowed-unresolved-imports and disable_error_code to rule levels under [tool.ty.rules].

How do I migrate a large project without fixing every error?

Run ty check --fix, then choose between ty check --add-ignore (inline comments) and ty check --update-baseline --baseline ty-baseline.json (a separate file). Both leave you with a passing check that only reports new problems.

Why does ty fail CI when there are only warnings?

Its default exit code is 1 for warnings as well as errors. Add --exit-zero-on-warning, or set the rule to "ignore".

What does warning[renamed-rule] mean?

Your config uses a rule name from the beta. The message gives the new name. Rename it in [tool.ty.rules].

Does ty support mypy plugins?

No. It has built-in support for Pydantic, Django, attrs and pytest, and no plugin system.

Can I run ty and mypy side by side?

Yes, and it is the safer way to migrate. Use two comments per suppressed line, # type: ignore[code] # ty: ignore[rule], so that neither checker reports an unused ignore.

Related Guides