Back to News for Developers

ELI5: Pyre - Fast Error Flagging for Large Python Codebases

May 10, 2021ByNavyata Bawa

In this blog post, we explain Pyre, a performant type-checker for Python 3, in a way that is super simple to understand. If you're interested in learning by watching or listening, check out a video about this open source project on our Facebook Open Source YouTube channel.

Why Pyre?

We love using Python at Facebook and Instagram, but when working on codebases as large as ours, the lack of static guarantees can make it hard to safely make changes. To help overcome this challenge, we developed Pyre, a static type checker designed to improve the quality of code, and the development speed in large Python codebases.

Pyre is PEP 484-compliant, and works in your favorite editor to automatically flag type errors. It’s optimized for near-instant responses so that you get immediate feedback, even in a very large codebase. Even if you're not fully committed to static typing, or if you have an existing codebase that you intend to annotate gradually over time, you can still get useful results.

Pysa is a security-focused tool built on top of Pyre, and we recommend using both for any current or future projects you’re building in Python. If you would like to learn more about Pysa, check out our ELI5 from Jessica Lin.

Where is Pyre used?

Pyre was open-sourced in May 2018. We use it extensively to maintain the codebases of Facebook and Instagram. To learn more about what Python types look like and how they make your codebase safer, check out this video presentation that explains how this is being used in Instagram codebases.

Where can I learn more?

To learn more about Pyre, visit the website where you can find documentation for developers who are just starting out or who want to use more advanced features. Check out the Pyre Getting Started section for resources on setting up a project, running Pyre and joining the Pyre community. To get more information on how to onboard your project to type-checking, check out this video tutorial on our Facebook for developers page.

If you have any further questions about Pyre, let us know on our YouTube channel, or by tweeting at us. We always want to hear from you and hope you will find this open source project and the new ELI5 series useful.

About the ELI5 series

In a series of short videos (~1 min in length), one of our Developer Advocates on the Facebook Open Source team explains a Facebook open source project in a way that is easy to understand and use.

We will write an accompanying blog post (like the one you're reading right now) for each of these videos, which you can find on our YouTube channel.

To learn more about Facebook Open Source, visit our open source site, subscribe to our YouTube channel, or follow us on Twitter and Facebook.

Interested in working with open source at Facebook? Check out our open source-related job postings on our career page by taking this quick survey.