Registry / testing / pyre-check

pyre-check

JSON →
library0.9.25pypypiunverified

Pyre-check is a performant static type checker for Python, developed by Meta (formerly Facebook). It is compliant with PEP 484 and designed to analyze large codebases incrementally, providing quick feedback. It operates with a client-server architecture and includes Pysa, a security-focused static analysis tool. The library is actively maintained with regular updates.

pip install pyre-check
INSTALL
IMPORT
SIG · PYRE-CHECK
P
pyre-check
testingpythonv0.9.25
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

This quickstart demonstrates setting up a basic Python project, installing `pyre-check` in a virtual environment, initializing its configuration, and running a simple type check to identify errors. The primary interaction with Pyre-check is through its command-line interface.

import os project_name = "my_pyre_project" os.system(f"mkdir {project_name} && cd {project_name}") # Simulate project directory os.chdir(project_name) # Setup virtual environment and install pyre-check os.system("python3 -m venv .venv") os.system("source .venv/bin/activate") # In a real shell, this would activate the venv os.system("pip install pyre-check") # Initialize Pyre configuration os.system("pyre init --no-watchman-comments --no-touch-pysa") # simplified for quickstart # Create a Python file with a type error with open("test_file.py", "w") as f: f.write(""" def greet(name: str) -> str: return f"Hello, {name}" i: int = 'string' # This will cause a type error print(greet(42)) # This will also cause a type error """) # Run Pyre to check for type errors print("\n--- Running Pyre Check ---") os.system("pyre") # In a real environment, you'd deactivate with 'deactivate' # os.system("deactivate")
pyre --version
Debug
Known issues
gotchaPyre-check strongly recommends installing and configuring `watchman` for optimal performance. Without `watchman`, Pyre defaults to non-incremental checks, which are significantly slower, especially on large codebases.
fix
Install `watchman` via your system's package manager (e.g., `brew install watchman` or `sudo apt-get install watchman`) and ensure it's running when using Pyre.
affects: All versions
gotchaMeta (the maintainer of Pyre-check) has announced and is promoting `Pyrefly` as its 'next-generation Python typechecker and language server'. While `pyre-check` is still active, this indicates a potential future shift in focus or eventual deprecation of `pyre-check` in favor of `Pyrefly`.
fix
Stay informed about `Pyrefly`'s development if you plan long-term commitment to Meta's Python type-checking tools. Currently, `pyre-check` remains supported.
affects: 0.9.x and later
gotchaPyre uses a 'gradual typing' approach by default, meaning it often treats unannotated code or types marked `Any` as implicitly correct. To enforce stricter type checking, which catches more potential issues (e.g., missing annotations or `Any` types), enable 'strict mode' in your `.pyre_configuration` or per file with `# pyre-strict`.
fix
Add `"strict": true` to your `.pyre_configuration` file, or add `# pyre-strict` to the top of individual Python files.
affects: All versions
breakingUpgrading Pyre-check can sometimes surface new type errors due to improved analysis or changes in how types are interpreted. To manage this during upgrades, Meta provides `pyre-upgrade` to automatically suppress newly introduced errors, allowing for gradual resolution.
fix
Use the `pyre-upgrade` command to automatically insert suppression comments for new errors after an upgrade, then address them systematically.
affects: Across major and minor version upgrades
Errors
Common errors & fixes
ImportError: cannot import name 'expand_global_root' from 'pyre_check.client.filesystem'
This error typically indicates an internal version mismatch or a breaking change in `pyre-check`'s internal client-server communication after an update, especially if local client files are out of sync with a running daemon or a newly installed binary.
fix
Ensure `pyre-check` is fully updated (`pip install --upgrade pyre-check`), restart any running Pyre daemon (`pyre stop` then `pyre start`), and if issues persist, try reinstalling in a fresh virtual environment.
ƛ No watchman binary found. To enable pyre incremental, you can install watchman
The `watchman` utility, a file watching service developed by Meta, is not installed or not discoverable in your system's PATH. Pyre relies on `watchman` for efficient, incremental type checking.
fix
Install `watchman` using your system's package manager (e.g., `brew install watchman` on macOS, `sudo apt-get install watchman` on Ubuntu/Debian). Ensure `watchman` is in your system's PATH.
ƛ Incompatible variable type [9]: i is declared to have type `int` but is used as type `str`.
This is a fundamental type error detected by Pyre, indicating a value is being assigned or used with a type that does not match its declared annotation.
fix
Correct the type annotation or the value assignment to ensure type consistency. For instance, if `i: int = 'string'` is the error, change it to `i: int = 123` or `i: str = 'string'`.
ERROR: Could not find a version that satisfies the requirement pyre-check (from versions: none)
This usually means your Python version does not meet the `pyre-check`'s `requires_python` specification, or there's a problem with your `pip` environment or PyPI access.
fix
Ensure you are using Python 3.8 or newer (`python3 --version`). If your Python version is compatible, try updating `pip` and `setuptools` (`pip install --upgrade pip setuptools`) and clearing pip's cache.
Upgrade
Version history
0.9.25latest on PyPI · released Jul 7, 2025
Audit
Dependencies
PythonrequiredRequired runtime environment.
watchmanrequiredEssential for incremental type checking and daemon mode, significantly improving performance for large projects. Install via system package manager (e.g., `brew install watchman` on macOS, `sudo apt-get install watchman` on Ubuntu).
Agent activity
2 hits · last 30 days
node
2
Resources
pyre-check — pip install pyre-check · libregistry