Meta's Rust-based Python type checker, Pyrefly, boosts speed and efficiency

Meta built a Python type checker in Rust that makes mypy feel like dial-up. 🔥 Pyrefly already has 5.4k stars, and it's not hard to see why. 𝗛𝗲𝗿𝗲'𝘀 𝘁𝗵𝗲 𝗱𝗲𝗮𝗹: Python's type checking story has always been slow and clunky. Pyrefly rewrites the whole thing from scratch in Rust (92% of the codebase). Giving you a lightning-fast type checker AND a full language server in one tool. Install it with pip, point it at your code, done. 𝗛𝗼𝘄 𝗶𝘁 𝘄𝗼𝗿𝗸𝘀 👉🏽 Three-step pipeline: resolve module exports, convert modules to bindings, solve bindings across your entire project 👉🏽 Uses Type::Var placeholders for recursive and unknown types that resolve later 👉🏽 Module-centric design prioritizing raw speed over fine-grained identifier solving 𝗪𝗵𝗮𝘁 𝘆𝗼𝘂 𝗴𝗲𝘁 👉🏽 Type inference that auto-detects variables and return types without annotations 👉🏽 Flow-sensitive types that track control flow (if/else, isinstance checks) 👉🏽 Incremental checking and parallel processing for large codebases 👉🏽 IDE support for VSCode, Neovim, and Zed out of the box 𝗪𝗵𝘆 𝘁𝗵𝗶𝘀 𝗺𝗮𝘁𝘁𝗲𝗿𝘀 👉🏽 Modular Rust crate architecture (pyrefly_util, pyrefly_types, pyrefly_config) 👉🏽 MIT licensed, 153 contributors, 11k+ commits 👉🏽 Browser sandbox so you can try it without installing anything 👉🏽 Biweekly office hours and an active Discord community Python type checking has been an afterthought for too long. A Rust-powered checker that doubles as your language server could finally make it a first-class experience. 𝘈𝘳𝘦 𝘺𝘰𝘶 𝘴𝘵𝘪𝘭𝘭 𝘶𝘴𝘪𝘯𝘨 𝘮𝘺𝘱𝘺, 𝘰𝘳 𝘩𝘢𝘷𝘦 𝘺𝘰𝘶 𝘴𝘸𝘪𝘵𝘤𝘩𝘦𝘥 𝘵𝘰 𝘴𝘰𝘮𝘦𝘵𝘩𝘪𝘯𝘨 𝘧𝘢𝘴𝘵𝘦𝘳? 🔗 Link in comments #python #rust #opensource #meta

  • No alternative text description for this image

See the runtime comparison in ty's pypi page. ty is nearly 2times faster than Pyrefly

  • No alternative text description for this image

Will definitely have a look, thanks for sharing

What would you say? Ty vs pyrefly?

how does its ability to resolve complex types (in gradually-typed code) compare to mypy or jetbrain's engine in pycharm?

How is this different from ty (type checker from Astral, also written in Rust)?

See more comments

To view or add a comment, sign in

Explore content categories