Improve Python code safety using a high-speed type checking engine
GitHub RepoImpressions1.1k

Improve Python code safety using a high-speed type checking engine

@githubprojectsPost Author

Project Description

View on GitHub

Faster, Friendlier Python Type Checking with Ty

If you've been using type hints in Python, you've probably run into the classic trade-off: you want the safety and better tooling that types provide, but you don't want to wait for ages every time you run mypy. The traditional type checkers can feel heavy, especially as your codebase grows.

What if you could get those same safety checks, but at a speed that feels almost instant? That's the promise behind Ty, a new type checking engine built by the folks at Astral (the same team behind Ruff). It's designed to be a drop-in replacement that just works, but works fast.

What It Does

Ty is a high-speed type checker for Python. You point it at your code, and it checks your type hints—just like mypy or pyright—ensuring you're not passing strings where integers are expected, or calling methods that don't exist on an object. It validates the contracts you've defined with your type annotations, catching bugs before they run.

The key difference? It's built with performance as a primary goal. It's not just a little faster; it's architected from the ground up to be blazingly quick, leveraging Rust for the core engine to minimize overhead and maximize throughput.

Why It's Cool

The obvious win is the speed. For developers working in larger codebases, or who want to integrate type checking into their save/editor workflow without lag, this is a game-changer. Faster feedback loops mean you're more likely to actually run the checker regularly.

But it's also cool because of its lineage. Astral has a proven track record with Ruff, which took the Python linter and formatter space by storm by being incredibly fast and reliable. They're applying the same philosophy and technical expertise to type checking. It's a pragmatic tool built by developers who understand the daily pain points.

It aims to be compatible, too. The goal is to understand the standard type hinting syntax and common patterns, making adoption as simple as swapping a command in your terminal or CI script.

How to Try It

Ready to feel the speed? Ty is available on GitHub and installable via pip.

First, install it:

pip install ty

Then, run it on your code. The simplest way is to point it at a directory or file:

ty check your_project/

You can also integrate it into your pre-commit hooks or replace your existing type checker in your pyproject.toml. Head over to the Ty GitHub repository for more detailed usage, configuration options, and to see the latest updates.

Final Thoughts

Ty feels like a logical and welcome evolution for the Python tooling ecosystem. As codebases grow and type hints become more sophisticated, we need the tools that enforce them to keep pace. Speed removes friction, and removing friction means developers actually use the tools that make their code more robust.

If you're already using type hints, giving Ty a spin is a no-brainer. The potential time savings are significant. If you've been hesitant to adopt type checking because of performance, this might be the thing that changes your mind. It's a practical step towards safer Python code, without the wait.

@githubprojects

Back to Projects
Project ID: 2639437c-f54c-4fdf-9665-5f9fca741b5fLast updated: December 7, 2025 at 08:56 PM