hn.today

Ty 1.0: an extremely fast Python type checker and language server

astral.sh700 points152 comments
Screenshot of Ty 1.0: an extremely fast Python type checker and language server

ty 1.0 is Astral’s Rust-based Python type checker and language server, positioned as an alternative to mypy, Pyright, and Pyrefly and now recommended for production use. Its focus on incremental analysis produces fast command-line checks and especially rapid editor updates. Across 18 ecosystem projects, ty was fastest on 16 for cold checks, averaging 1.46 times the speed of Pyrefly; in editor benchmarks, it led on 14 of 17 projects. At OpenAI, switching to ty brought a median 24-fold speedup and cut peak memory use by 73% across millions of lines of Python. Adoption has climbed quickly: downloads increased 29-fold in a year, and ty was the third-most-used checker in a survey of popular PyPI packages.

The release also emphasizes typing behavior, not just speed. Its gradual, set-theoretic approach and improved generics solver support bidirectional inference, helping catch errors in generic functions and infer more precise types from context. On a typing conformance suite, ty’s false positives and false negatives fell substantially from its beta results. Version 1.0 adds built-in understanding of libraries including Pydantic, Django, pytest, and attrs, plus optional inference of unannotated return types. Diagnostics can trace problems to their causes across code, suggest corrections, and apply fixes automatically. For existing projects, migration tools can add ignore comments or establish a baseline so teams can address old findings gradually while detecting new ones.

Read on astral.sh152 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Laravel Go

Laravel Go

Laravel for Go is a full-stack web framework with routing, validation, database tools, background jobs, workflows, and real-time events. It also supports Inertia for frontend integration and is open source under the MIT license. (github.com)

Laravel Go

Laravel Go

Laravel Go is a batteries-included Go framework that combines routing, data access, authentication, queues, workflows, and other features in one package. It uses standard Go patterns and Inertia to serve React, Vue, or Svelte pages without separate API boilerplate. (laravel.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.