# Pyre-check: Performant Type-Checking and Static Analysis for Python

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/facebook-pyre-check
Generated for open source discovery and AI-assisted research.

Pyre-check is a high-performance type checker for Python, compliant with PEP 484, designed for incremental analysis of large codebases. It features Pysa, a security-focused static analysis tool for identifying data flow issues in Python applications, enhancing code quality and security.

GitHub: https://github.com/facebook/pyre-check
OSRepos URL: https://osrepos.com/repo/facebook-pyre-check

## Summary

Pyre-check is a high-performance type checker for Python, compliant with PEP 484, designed for incremental analysis of large codebases. It features Pysa, a security-focused static analysis tool for identifying data flow issues in Python applications, enhancing code quality and security.

## Topics

- Python
- Type Checking
- Static Analysis
- Code Quality
- Security
- OCaml
- Program Analysis
- Developer Tools

## Repository Information

Last analyzed by OSRepos: Sun Nov 16 2025 16:00:46 GMT+0000 (Western European Standard Time)
Detail views: 2
GitHub clicks: 3

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction
Pyre-check is a performant type checker for Python, developed by Facebook, that ensures your Python code adheres to type hints as defined by [PEP 484](https://www.python.org/dev/peps/pep-0484/){:target="_blank"}. It excels at analyzing large codebases, providing incremental type-checking for rapid feedback. Beyond basic type-checking, Pyre-check integrates **Pysa**, a powerful security-focused static analysis tool. Pysa helps identify potential security vulnerabilities by reasoning about data flows within Python applications, making it an invaluable asset for maintaining robust and secure code.

## Installation

To get started with Pyre-check, ensure you have Python 3.8 or later and Watchman installed on your system.

### Requirements

*   **Python 3.8+**: [https://www.python.org/getit/](https://www.python.org/getit/){:target="_blank"}
*   **Watchman**: [https://facebook.github.io/watchman/](https://facebook.github.io/watchman/){:target="_blank"}

For macOS users, you can install both with Homebrew:

bash
$ brew install python3 watchman


For Ubuntu, Mint, or Debian users, use `apt-get` for Python and Homebrew for Watchman:

bash
$ sudo apt-get install python3 python3-pip python3-venv
$ brew install watchman


### Project Setup

Once the requirements are met, set up a new project and install Pyre-check:

bash
$ mkdir my_project && cd my_project
$ python3 -m venv ~/.venvs/venv
$ source ~/.venvs/venv/bin/activate
(venv) $ pip install pyre-check


Next, initialize Pyre-check in your project directory. This creates the necessary configuration files (`.pyre_configuration` and `.watchmanconfig`):

bash
(venv) $ pyre init


## Examples

After setting up your project, you can immediately run Pyre-check to find type errors. Let's create a simple Python file with an intentional type mismatch:

bash
(venv) $ echo "i: int = 'string'" > test.py


Now, execute Pyre-check:

bash
(venv) $ pyre


You will see output similar to this, indicating the type error:


 ? Found 1 type error!
test.py:1:0 Incompatible variable type [9]: i is declared to have type `int` but is used as type `str`.


The first run starts a daemon for incremental analysis, making subsequent checks much faster as you modify your code.

## Why Use Pyre-check?

Pyre-check offers several compelling reasons for Python developers to integrate it into their workflow:

*   **Performance**: Designed for large-scale applications, Pyre-check provides incremental type-checking, delivering near-instantaneous feedback as you write code.
*   **Enhanced Security with Pysa**: The integrated Pysa tool goes beyond simple type-checking, offering advanced static analysis to detect security vulnerabilities related to data flows, helping you build more secure applications.
*   **PEP 484 Compliance**: It fully supports Python's official type hinting standard, ensuring your codebase adheres to modern best practices.
*   **Robustness**: Developed by Facebook, Pyre-check is a mature and well-supported tool, trusted by large organizations for maintaining code quality.

## Links

*   **GitHub Repository**: [https://github.com/facebook/pyre-check](https://github.com/facebook/pyre-check){:target="_blank"}
*   **Official Documentation**: [https://pyre-check.org/docs/](https://pyre-check.org/docs/){:target="_blank"}
*   **Pyre Playground**: [https://pyre-check.org/play](https://pyre-check.org/play){:target="_blank"}
*   **Pysa GitHub Action**: [https://github.com/marketplace/actions/pysa-action](https://github.com/marketplace/actions/pysa-action){:target="_blank"}