Pyre -> Pyrefly Type Checker

We have been developing Pyrefly (a Python type checker and LSP) for several months, which you may have noticed on Pyre’s github. We want to give this community an early preview of what we have been working on, so we created a playground that you can try here:

Try Pyrefly: the Pyrefly Playground | Pyrefly.

There is a lot of work left to do, and we hope to have a beta available by PyCon that folks can try in the IDE. The current version isn’t ready to use in your Python project just yet, but we wanted to share our code and high level design which has been promising for modeling some of the trickier type system features to support, like generics and dataclasses.

20 Likes

I just tried running it on a project of mine (yes, I know it is not intended for external use yet); it shows quite a few false positives. Some questions:

1 Like
  • We’re delighted to accept bug reports.
  • Please send them to @facebook/pyrefly.
  • We have a generic LSP as part of Pyrefly (pyrefly lsp). We’ve wrapped that into VS Code, but will certainly take contributions for other editors, and might well work to enable them ourselves closer to when it is ready.
3 Likes

Oh, amazing release! Will make sure to check that out. Two slightly related questions:

  1. What do you think of the fact that Astral is developing a type checker on their own, within ruff? ruff is already built as an LSP.
  2. A couple of years ago I read about wasabi, a Python LSP [ref]. Was it ever actually released?

Thanks for the great job!

3 Likes
  1. Astral is doing impressive work, and it’s exciting to see their contributions to the Python development tooling community. We would love to work with them if they are interested.

  2. Regarding Wasabi, there are currently no plans to release it. However, if there are specific features from Wasabi that you would like to see in Pyrefly or the IDE in general, please feel free to open an issue on our GitHub.

Thanks for your support and feedback!

1 Like

Besides its speed and popularity, are there any other reasons for why you went with rust? And would you, at this point, still recommend it to someone tasked to write a type-checker from scratch?

1 Like

Speed and popularity were big parts of it. We would have preferred Python, but didn’t think we could hit our ambitious performance goals using Python today (hopefully future work around free-threaded Python and JIT changes that). After ruling out Python, we wanted something that was safe, cross-platform, compiled to WASM (Playground experience). Rust and Go are probably the best choices for those goals, and the team had more experience with Rust.

6 Likes

I am delighted to see more work happening in the Python tooling sphere, especially in type checking. I’d love to use parts of this tool, for example, to build a reference graph of a project (similar to “Go to Definition” features in an LSP but accessing that information programmatically). Just want to suggest keeping the doors open to using the project as a library in other Python / Rust projects.

1 Like

Hi @tusharsadhwani, we have heard of features similar to this one. It’s not on our immediate roadmap, but something on our radar generally. If you don’t mind explaining what you are hoping to do with a bit more detail in an issue, we can consider it once we have a clearer picture of the larger needs for exporting data out of Pyrefly.

1 Like

I’ve dropped the request in #22.

2 Likes