An Intro to ty – The Extremely Fast Python type checker

Ty is a brand new, extremely fast Python type checker written in Rust from the fine folks at Astral, the makers of Ruff. Ty is in preview and is not ready for production use, but you can still try it out on your code base to see how it compares to Mypy or other popular Python type checkers.

Getting Started with ty

You can try out ty using the online playground, or run ty with uvx to get started quickly:

uvx ty

If you prefer to install ty, you can use pip:

python -m pip install ty

Astral provides other installation methods as well.

Using the ty Type Checker

Want to give ty a try? You can run it in much the same way as you would Ruff. Open up your terminal and navigate to your project’s top-level directory. Then run the following command:

ty check

If ty finds anything, you will quickly see the output in your terminal.

Astral has also provided a way to exclude files from type checking. By default, ty ignores files listed in an .ignore or .gitignore file.

Adding ty to Your IDE

The Astral team maintains an official VS Code extension for ty. You can get it from the VS Code Marketplace. Their documentation states that other IDEs can also use ty if they support the language server protocol.

Wrapping Up

Ruff is a great tool and has been adopted by many teams since its release. Ty will likely follow a similar trajectory if it as fast and useful as Ruff has been. Only time will tell. However, these new developments in Python tooling are exciting and will be fun to try. If you have used ty, feel free to jump into the comments and let me know what you think.