We Tried ty for Performance. It Found Real Bugs
Blog post from Dagster
Dagster's migration from Pyright to Astral's new Python type checker, ty, significantly enhanced their type-checking process, delivering both performance improvements and the unexpected benefit of identifying runtime bugs previously missed by Pyright. As Dagster's monorepo expanded, with more than 100 packages and continuous contributions, Pyright's type-checking duration became a bottleneck, taking about 15 minutes per CI run. In contrast, ty reduced this time to just 1-2 minutes, thanks to its Rust-native parser and analysis engine. Despite initial concerns over ty flagging approximately 4,500 diagnostics, the stricter type inference exposed legitimate bugs and unsafe assumptions, such as in the Pandera schema, that Pyright had overlooked. The migration, executed via parallel coding agents over 100 incremental pull requests, transformed the process into a scalable effort, despite ty being pre-1.0 with some diagnostic noise. Ultimately, the switch to ty not only streamlined CI processes but also improved code quality by revealing potential runtime issues, making it a promising tool for the Dagster team.