Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 25, 2026·3 min de lectura

Pyre — Fast Type Checker for Python by Meta

Pyre is a performant, static type checker for Python developed at Meta, designed to catch type errors in large codebases with minimal configuration and fast incremental analysis.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Pyre Overview
Comando CLI universal
npx tokrepo install 8bc4ba20-5837-11f1-9bc6-00163e2b0d79

Introduction

Pyre is a static type checker for Python that analyzes type annotations to catch bugs before runtime. Built by Meta for internal use on millions of lines of Python code, it prioritizes speed and incremental analysis so developers get fast feedback without disrupting their workflow.

What Pyre Does

  • Checks Python type annotations against PEP 484, 526, 544, and later typing PEPs
  • Runs in incremental watch mode with sub-second feedback on file saves
  • Infers return types and variable types where annotations are missing
  • Integrates with editors via the Language Server Protocol
  • Includes Pysa, a taint analysis tool for finding security vulnerabilities

Architecture Overview

Pyre is implemented in OCaml for performance. It parses Python source files into an internal AST, resolves imports and builds a module dependency graph, then runs constraint-based type inference and checking in parallel. In watch mode, it uses a file-system watcher to re-analyze only changed files and their dependents, keeping incremental checks fast even in large repos.

Self-Hosting & Configuration

  • Install via pip: pip install pyre-check
  • Initialize with pyre init to create a .pyre_configuration file
  • Set source_directories and search_path to control what gets checked
  • Use strict mode for stricter checking or unsafe to suppress specific errors
  • Configure per-file overrides with inline # pyre-strict or # pyre-ignore comments

Key Features

  • Sub-second incremental checks in watch mode for instant feedback
  • OCaml implementation delivers multi-threaded parallel analysis
  • Pysa security analyzer detects taint flows (SQL injection, XSS, etc.) using the same type infrastructure
  • LSP support provides hover types, go-to-definition, and autocomplete in editors
  • Gradual typing lets teams adopt type checking incrementally, file by file

Comparison with Similar Tools

  • mypy — The reference Python type checker; Pyre is faster on large codebases but mypy has broader community plugin support
  • Pyright — Microsoft TypeScript-based checker powering Pylance; fast and well-integrated with VS Code
  • Pytype — Google type checker with cross-function inference; slower but infers more without annotations
  • Ruff — Linter and formatter, not a type checker; complementary to Pyre

FAQ

Q: Can I use Pyre alongside mypy? A: Yes. Both read the same PEP 484 type annotations. You can run both and compare results during migration.

Q: What is Pysa? A: Pysa is Pyre's taint analysis engine that tracks untrusted data through function calls to detect security vulnerabilities like SQL injection.

Q: Does Pyre support Python 3.12+ syntax? A: Pyre tracks CPython releases. Check the changelog for the latest supported Python version.

Q: How does Pyre handle third-party libraries without type stubs? A: Pyre uses typeshed stubs and can fall back to Any for untyped libraries. You can also add custom stubs.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados