{"name":"Pyre-check: Performant Type-Checking and Static Analysis for Python","description":"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","url":"https://osrepos.com/repo/facebook-pyre-check","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/facebook-pyre-check","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/facebook-pyre-check.md","json":"https://osrepos.com/repo/facebook-pyre-check.json","topics":["Python","Type Checking","Static Analysis","Code Quality","Security","OCaml","Program Analysis","Developer Tools"],"keywords":["Python","Type Checking","Static Analysis","Code Quality","Security","OCaml","Program Analysis","Developer Tools"],"stars":null,"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.","content":"## Introduction\nPyre-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.\n\n## Installation\n\nTo get started with Pyre-check, ensure you have Python 3.8 or later and Watchman installed on your system.\n\n### Requirements\n\n*   **Python 3.8+**: [https://www.python.org/getit/](https://www.python.org/getit/){:target=\"_blank\"}\n*   **Watchman**: [https://facebook.github.io/watchman/](https://facebook.github.io/watchman/){:target=\"_blank\"}\n\nFor macOS users, you can install both with Homebrew:\n\nbash\n$ brew install python3 watchman\n\n\nFor Ubuntu, Mint, or Debian users, use `apt-get` for Python and Homebrew for Watchman:\n\nbash\n$ sudo apt-get install python3 python3-pip python3-venv\n$ brew install watchman\n\n\n### Project Setup\n\nOnce the requirements are met, set up a new project and install Pyre-check:\n\nbash\n$ mkdir my_project && cd my_project\n$ python3 -m venv ~/.venvs/venv\n$ source ~/.venvs/venv/bin/activate\n(venv) $ pip install pyre-check\n\n\nNext, initialize Pyre-check in your project directory. This creates the necessary configuration files (`.pyre_configuration` and `.watchmanconfig`):\n\nbash\n(venv) $ pyre init\n\n\n## Examples\n\nAfter 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:\n\nbash\n(venv) $ echo \"i: int = 'string'\" > test.py\n\n\nNow, execute Pyre-check:\n\nbash\n(venv) $ pyre\n\n\nYou will see output similar to this, indicating the type error:\n\n\n ? Found 1 type error!\ntest.py:1:0 Incompatible variable type [9]: i is declared to have type `int` but is used as type `str`.\n\n\nThe first run starts a daemon for incremental analysis, making subsequent checks much faster as you modify your code.\n\n## Why Use Pyre-check?\n\nPyre-check offers several compelling reasons for Python developers to integrate it into their workflow:\n\n*   **Performance**: Designed for large-scale applications, Pyre-check provides incremental type-checking, delivering near-instantaneous feedback as you write code.\n*   **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.\n*   **PEP 484 Compliance**: It fully supports Python's official type hinting standard, ensuring your codebase adheres to modern best practices.\n*   **Robustness**: Developed by Facebook, Pyre-check is a mature and well-supported tool, trusted by large organizations for maintaining code quality.\n\n## Links\n\n*   **GitHub Repository**: [https://github.com/facebook/pyre-check](https://github.com/facebook/pyre-check){:target=\"_blank\"}\n*   **Official Documentation**: [https://pyre-check.org/docs/](https://pyre-check.org/docs/){:target=\"_blank\"}\n*   **Pyre Playground**: [https://pyre-check.org/play](https://pyre-check.org/play){:target=\"_blank\"}\n*   **Pysa GitHub Action**: [https://github.com/marketplace/actions/pysa-action](https://github.com/marketplace/actions/pysa-action){:target=\"_blank\"}","metrics":{"detailViews":2,"githubClicks":3},"dates":{"published":null,"modified":"2025-11-16T16:00:46.000Z"}}