{"slug": "ty-1-0-checked-fastapi-in-0-57s-mypy-took-7-75s", "title": "Ty 1.0 checked FastAPI in 0.57s. mypy took 7.75s", "summary": "Astral released ty 1.0, a Python type checker that a developer benchmarked on FastAPI (54 files, 23,803 lines) at 0.57 seconds cold versus 7.75 seconds for mypy and 10.68 seconds for pyright, with peak memory of 124 MB against 327 MB and 570 MB respectively. On default settings ty also emitted 16 diagnostics (3 errors, 13 warnings) where mypy reported zero, and pyright reported 54 errors and 1 warning. The tester found ty caught a misspelled TypedDict key that mypy missed, but warned that migrating a mypy-clean repo to ty means a triage session rather than a green check.", "body_md": "Astral shipped ty 1.0 today, and the headline number is a 24x speedup at OpenAI. I ran it myself on FastAPI — 54 files, 23,803 lines — and got 0.57 seconds cold, against 7.75 for mypy and 10.68 for pyright. The speed is real. The diagnostic counts are the interesting part.\n\nSame machine for all three: an AMD EPYC VM, 4 vCPUs, Python 3.12. I cloned FastAPI at 0.165.0, installed it in a venv with its real dependencies (Pydantic, Starlette, the lot), and ran each checker cold — caches wiped before every run — three times each. ty 1.0.0, mypy 2.4.1 (compiled), pyright 1.1.414, all on default settings. No config files, no per-checker tuning: this is what you get out of the box.\n\n```\nCold check, FastAPI 0.165.0 (54 files, 23,803 lines), median of 3 runs:\n\nChecker    Time     Peak RSS    Diagnostics\nty 1.0.0   0.57 s    124 MB      16 (3 errors, 13 warnings)\nmypy       7.75 s    327 MB       0\npyright   10.68 s    570 MB      54 errors, 1 warning\n\nRatios: ty is 13.6x faster than mypy, 18.7x faster than pyright.\nMemory: ty uses 2.6x less than mypy, 4.6x less than pyright.\n```\n\nIndividual runs, so you can see the spread: ty 0.65 / 0.57 / 0.51 s; mypy 8.44 / 7.58 / 7.75 s; pyright 10.52 / 10.68 / 11.02 s. The ordering never changed. On this workload ty is not marginally faster, it is a different category — sub-second where the others are eight to eleven seconds. That is the difference between a check you run on every save and one you run in CI.\n\nSpeed is one axis. The other is what each checker says about a codebase its own maintainers keep clean. mypy reported zero issues. ty reported 16 diagnostics, pyright 54. Somebody is wrong, and it is not obvious who.\n\nty's 16 break down like this:\n\n```\n 3 error   incompatible-mutable-override: attributes `model` and `scheme`\n           overridden with incompatible mutable types\n 4 warning deprecated: `contextmanager` / `asynccontextmanager` overloads\n 5 warning redundant-condition: always-truthy checks (tuple, string, function)\n 4 warning renamed-rule-in-ignore-comment: `# ty: ignore` comments naming\n           rules that were renamed before 1.0\n```\n\nThe three errors are the ones to stare at. FastAPI overrides `model` and `scheme` attributes in subclasses, and ty's stricter override checking flags them where mypy stays silent. Are they real bugs? FastAPI's test suite passes and mypy is happy, so at minimum they are the kind of finding you would argue about in review, not the kind you fix at midnight. pyright's 54 are dominated by `reportTypedDictNotRequiredAccess` complaints about optional TypedDict keys in FastAPI's telemetry module — again, a strictness choice more than a bug list.\n\nSo the honest scoreboard is: ty is dramatically faster, and on default settings it is also louder than mypy on a clean codebase. Loud is not wrong — ty's whole pitch is that it infers more from unannotated code, which means it has more opinions about code that was never annotated for it. But if you migrate a mypy-clean repo to ty tomorrow, expect a triage session, not a green check.\n\nAstral's announcement leans on inference: ty figures out types from context where the others give up or guess wrong. I ran both examples verbatim.\n\nFirst, the misspelled TypedDict key:\n\n``` python\nfrom typing import TypedDict\n\nclass Runner(TypedDict):\n    name: str\n    seconds: float\n\ndef podium(runners: list[Runner]) -> list[Runner]:\n    ranked = sorted(\n        [*runners, {\"name\": \"Ada\", \"seconds\": 53.2}],\n        key=lambda runner: runner[\"second\"],  # the bug\n    )\n    return ranked[:3]\n```\n\nty catches it and offers the fix:\n\n``` php\nerror[invalid-typed-dict-key]: Unknown key \"second\" for TypedDict `Runner`\n  --> podium.py:10:35\n   |  key=lambda runner: runner[\"second\"],\n   |                            ------ ^^^^^^^^ Did you mean \"seconds\"?\n```\n\nmypy, on the same file, reports 3 errors — and none of them is the misspelled key. It complains about the return types of `sorted` and the list instead. The actual bug, the one that silently sorts by nothing at runtime, sails through. That is a genuine win for ty, and it is the kind of win that matters more than the benchmark table: a checker that finds the bug you actually wrote.\n\nSecond, the conjoined-predicates example, where ty infers the input must be both `Sized` and `Iterable[int]`:\n\n```\nvalid_batch = satisfies_all(large_enough, all_positive)\nvalid_batch([1, 2, 3])        # accepted\nvalid_batch(iter([1, 2, 3]))  # flagged\n```\n\nty accepts the list and flags the iterator, exactly as the blog claims — `Expected Sized & Iterable[int], found Iterator[int]`. mypy infers `Never` for the conjoined input and rejects both calls, also exactly as the blog claims. I verified both behaviors myself rather than trusting the screenshots.\n\nAstral's blog makes three more claims I could not reproduce on this box: the 24x median speedup and 73% peak-memory reduction from OpenAI's internal migration, the 1.46x edge over Pyrefly on their 18-project benchmark, and the conformance numbers (ty: 14 false positives / 13 false negatives, mypy: 190 / 109). Those are their measurements on their workloads, stated as theirs. My numbers point the same direction on a workload I chose — FastAPI, not their benchmark suite — but do not take my 13.6x as confirmation of their 24x. Different codebases, different stories.\n\nOne more caveat, stated plainly: this is one repo, one machine, default settings, three runs each. pyright in particular is configurable enough that a tuned setup would tell a different story on diagnostics, though not on wall time — its 10.68 seconds is mostly the checker, not the config. And cold-check time is not editor latency; ty's incremental architecture is built for the long-lived language server, which I did not measure.\n\nty 1.0's speed claim survives contact with a real codebase: 0.57 seconds where mypy needs 7.75 and pyright 10.68, at a quarter of the memory. The inference examples survive too — it found a real bug mypy walked past. What does not survive untouched is the idea that you can swap checkers for free: on defaults, ty flags 16 things in a mypy-clean FastAPI, and three of them are errors you would have to adjudicate. The speed is a reason to try it. The triage list is the price of admission.", "url": "https://wpnews.pro/news/ty-1-0-checked-fastapi-in-0-57s-mypy-took-7-75s", "canonical_source": "https://dev.to/frankchu/ty-10-checked-fastapi-in-057s-mypy-took-775s-5546", "published_at": "2026-12-02 00:34:52+00:00", "updated_at": "2026-12-02 00:44:39.147950+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools"], "entities": ["Astral", "ty", "FastAPI", "mypy", "pyright", "OpenAI", "Pydantic", "Starlette"], "also_reported_by": [], "takeaway": "On FastAPI's 54-file, 23,803-line codebase, ty 1.0 checked cold in 0.57 s at 124 MB peak RSS versus mypy's 7.75 s at 327 MB and pyright's 10.68 s at 570 MB, but ty reported 16 diagnostics where mypy reported zero.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/ty-1-0-checked-fastapi-in-0-57s-mypy-took-7-75s", "markdown": "https://wpnews.pro/news/ty-1-0-checked-fastapi-in-0-57s-mypy-took-7-75s.md", "text": "https://wpnews.pro/news/ty-1-0-checked-fastapi-in-0-57s-mypy-took-7-75s.txt", "jsonld": "https://wpnews.pro/news/ty-1-0-checked-fastapi-in-0-57s-mypy-took-7-75s.jsonld"}}