Skip to content
CAI
Software that uses CAICheck a score

facebook/pyrefly

70.1

Strong · 29 September 2026

327.9k

lines of production code

Rust

with Python

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Pyrefly is a high-performance Python static type checker and language server that provides IDE features such as type inference, completion, and refactoring. It supports complex type systems including shape-aware tensor analysis for libraries like PyTorch and NumPy, and integrates with build systems like Buck2. The tool offers extensive third-party stub coverage, configuration migration from other checkers, and a protocol for external type querying.

How it got here

2025 — Public release and ecosystem expansion

73 changes.

This period marked the initial public release of Pyrefly, establishing the project's infrastructure through a new website, VS Code extension, and comprehensive documentation. The type checker's capabilities were significantly expanded with bundled third-party stubs for major libraries like pandas and AWS, alongside the introduction of the Type Server Protocol for external integration. Concurrently, the core engine underwent substantial refactoring to support advanced features such as shape-aware solving, build-system integration, and robust error reporting.

2026 — Tensor shape stubs and LSP enhancements

74 changes.

This period focused on expanding static type checking for tensor libraries by introducing shape-aware stubs for PyTorch, NumPy, and JAX, alongside a new type-level DSL for dimension inference. The team also significantly enhanced the language server with improved code intelligence for dictionaries and pytest fixtures, while establishing robust automation pipelines for issue ranking and performance benchmarking.

Features

Add PyTorch walltime benchmarks for cold start, error propagation, and full check

New benchmarks have been added to measure real-world LSP performance against a pinned PyTorch checkout. The suite includes a cold-start benchmark that measures the latency to the first cross-file go-to-definition, an error-propagation benchmark that measures incremental recheck latency when a type error is introduced in a heavily-imported file, a full-check benchmark that measures whole-project batch-check throughput, an indexed-memory benchmark for cold whole-project indexing time, and a workspace-symbol benchmark for warm symbol lookup latency. These benchmarks share a common harness that manages the PyTorch checkout (via internal resources or OSS git clone) and configures the LSP server to disable background workspace indexing to isolate the measured operations.

pyrefly/benches/pytorch · high confidence

Add SARIF output support for \`pyrefly check\`

The \pyrefly check\ command now supports generating output in SARIF 2.1.0 format. This new capability allows users to export type-checking results to a standardized JSON structure compatible with various security and code analysis tools. The implementation includes mapping Pyrefly's severity levels to SARIF levels, handling file locations and regions, and supporting baseline error states to distinguish between new and unchanged diagnostics.

pyrefly/lib/commands/check · high confidence

Add Thrift schema definitions for Glean query results

Added \glean\_query\_types.thrift\ to define the data structures used for deserializing results from Glean Angle queries. This includes specific structs for \FindReferencesResult\ (containing File, ByteSpan, and Digest) and \WorkspaceSymbolResult\ (containing Name, File, Span, and Declaration), along with their underlying type definitions, enabling the system to correctly interpret query responses from the Glean backend.

pyrefly · high confidence

Add bundled type stubs for botocore

Pyrefly now includes bundled type stubs for the botocore library, providing static type checking support for AWS SDK for Python (botocore). This addition covers core modules including authentication, client creation, configuration, credentials, and request handling, enabling better IDE support and type safety for users interacting with AWS services.

_crates/pyrefly\_bundled/third\party/stubs/botocore-stubs · high confidence

Add memory benchmark for fully-indexed PyTorch project

Users can now measure the memory footprint of the language server when fully indexing a project by running the new \pytorch\_memory\ benchmark. This standalone binary indexes the pinned PyTorch checkout at the \Require::Indexing\ level (matching the background indexing used by the LSP) and reports the process's resident set size (current and peak RSS). The benchmark is isolated in its own process to ensure the memory figures reflect only the indexed project state, avoiding contamination from other benchmark workloads.

_crates/pyrefly\_bench\_harness, pyrefly/benches/pytorch\memory · high confidence

Add microtorch sandbox examples and type-checking infrastructure

Introduces a new microtorch module containing a minimal tensor model (microtorch.pyi) and shape extensions (shape\_extensions.pyi) designed to test Pyrefly's core shape behavior without depending on a real tensor library. This includes a suite of sandbox examples (overview, reference, setup, tutorial-basics) that demonstrate tensor operations like matrix multiplication, concatenation, and diagonal extraction, along with a test runner (run\_pyrefly.py) and test suites to validate these type-checking scenarios.

tensor-shapes/microtorch · high confidence

Add numpy tensor-shape examples for physical science and statistics

New example files \physical\_science.py\ and \stats.py\ have been added to the \tensor-shapes/pyrefly-numpy-stubs/examples\ directory. These files demonstrate the use of the \shape\_extensions\ library (specifically \IntVar\ and \assert\_shape\) with NumPy arrays to verify tensor shapes in physical science simulations (e.g., harmonic oscillators, gravitational forces) and statistical algorithms (e.g., OLS, PCA, logistic regression).

tensor-shapes/pyrefly-numpy-stubs/examples · high confidence

Add shape-aware type stubs for NumPy

This change introduces a new \numpy-stubs\ package containing \.pyi\ stub files that provide shape-aware type information for NumPy. The stubs include a \py.typed\ marker file and define shape inference logic via a type-level DSL in \\_shapes.pyi\, enabling static type checkers to understand output shapes for operations like \matmul\, \reduce\, \stack\, and \expand\dims\. The \\\init\\.pyi\ re-exports core NumPy functions and types, while \random/\\init\\_.pyi\ adds specific shape-aware overloads for functions like \randn\.

tensor-shapes/pyrefly-einops-stubs, tensor-shapes/pyrefly-jax-stubs/jax-stubs, tensor-shapes/pyrefly-numpy-stubs/numpy-stubs · high confidence

Add shell completion generation and allocator configuration to the pyrefly binary

The pyrefly CLI now includes a \completion\ subcommand that generates shell completion scripts (e.g., for bash, zsh, fish) for its own argument tree, ensuring hidden commands and flags are excluded from the generated output while remaining functional when typed explicitly. Additionally, the binary configures memory allocators based on the target operating system: it uses jemalloc on Linux and macOS (unless built for fbcode) and mimalloc on Windows to optimize performance. The entrypoint also enables stack overflow backtraces in debug builds to aid in troubleshooting.

pyrefly/bin · high confidence

Add type stubs for torch.distributions with shape-aware signatures

The \torch-stubs/distributions\ package now provides comprehensive type stubs for PyTorch distributions, enabling static type checkers to verify tensor shapes. The \Distribution\ base class and specific distributions like \Normal\ and \Categorical\ use \IntTuple\-bound \EventShape\ type variables to ensure that \sample()\, \rsample()\, and \log\_prob()\ preserve or correctly transform event shapes. The stubs also re-export submodules for \transforms\ and \constraints\ to support existing import patterns, and define shape-aware signatures for \Transform\ operations.

tensor-shapes/pyrefly-torch-stubs/torch-stubs/distributions · high confidence

Added benchmarking scripts for type checker performance

New scripts have been added to the \scripts/benchmark\ directory to measure and compare the execution time and memory usage of Python type checkers (pyright, pyrefly, ty, mypy, zuban) across popular open-source packages. The \typecheck\_benchmark.py\ script captures wall-clock latency and peak RSS memory, while \lsp\_benchmark.py\ measures LSP 'Go to Definition' latency. These tools allow users to generate detailed JSON reports and summary tables to evaluate type checker performance characteristics.

scripts/benchmark · high confidence

Added bundled pandas-stubs for type checking

The bundled third-party stubs now include type definitions for the pandas library. This adds comprehensive .pyi stub files covering the main pandas API, core data structures (DataFrame, Series, Index), configuration options, internal libraries, and testing utilities, along with the corresponding BSD 3-Clause license file. Users can now benefit from static type checking support for pandas within the bundled environment.

_crates/pyrefly\_bundled/third\party/stubs/pandas-stubs · high confidence

Added conformance test documentation and update script

The conformance folder now includes a README.md explaining the structure of the Python typing conformance test suite and providing specific commands for GitHub and Meta internal developers to update test sources, check outputs, and compare results. Additionally, a new \update\_conformance\_sources.sh\ script was added to automate the process of cloning upstream Python typing tests and copying them into the \third\_party\ directory.

conformance · high confidence

Added pandas-stubs type hints for \_libs/tslibs and \_libs/window

This change adds bundled Python type stubs (.pyi files) for the pandas internal modules \_libs/tslibs and \_libs/window. Users will now receive type-checking support for core time-series components including Timestamp, Timedelta, Period, NaT, and various date offsets (e.g., BusinessDay, Hour, Day) when using pyrefly or compatible type checkers with pandas.

_crates/pyrefly\_bundled/third\_party/stubs/pandas-stubs/\_libs/tslibs, crates/pyrefly\_bundled/third\_party/stubs/pandas-stubs/\libs/window · high confidence

Added scikit-learn type stubs to Pyrefly bundle

Pyrefly now includes bundled type stubs for the scikit-learn library, enabling static type checking and improved IDE support for sklearn code. This addition covers core modules including clustering algorithms (KMeans, DBSCAN, AgglomerativeClustering, etc.), loss functions and distributions, base estimator mixins, and configuration contexts, along with the necessary MIT license file.

_crates/pyrefly\_bundled/third\party/stubs/sklearn-stubs · high confidence

Added shape type stubs for JAX neural network activation functions

This change introduces Python type stubs for the \jax.nn\ module, providing shape inference for activation functions such as \relu\, \sigmoid\, \softmax\, and \elu\. The stubs define how input tensor shapes are preserved or broadcasted (e.g., when parameters like \alpha\ in \elu\ are arrays) and ensure that output shapes are correctly typed for static analysis tools.

tensor-shapes/pyrefly-jax-stubs/jax-stubs/nn · high confidence

Added type stubs for scikit-image

This change adds bundled type stubs for the scikit-image library, enabling static type checking and improved IDE support for code using scikit-image. The stubs cover core modules including feature detection (SIFT, ORB, HOG, Canny), image drawing, data fetching utilities, and graph-based segmentation, along with shared utilities and typing definitions.

_crates/pyrefly\_bundled/third\party/stubs/skimage-stubs · high confidence

Added type stubs for the SymPy library

The Pyrefly bundle now includes generated type stubs for the SymPy library, enabling type checking and autocomplete for SymPy code. This addition covers the main SymPy namespace along with submodules for algebraic structures (such as Quaternion), assumption handling (predicates and handlers for calculus, matrices, number theory, and sets), and core logic components. A Microsoft MIT license file is also included to satisfy the licensing requirements for these third-party stubs.

_crates/pyrefly\_bundled/third\_party/stubs/conans-stubs, crates/pyrefly\_bundled/third\_party/stubs/sympy-stubs, crates/pyrefly\_bundled/third\party/stubs/vispy-stubs · high confidence

Added type stubs for torch.nn.attention module

This change introduces new type stub files for the \torch.nn.attention\ package, specifically defining the public API for \flex\_attention\ and its associated \BlockMask\ class. The stubs provide type signatures for \flex\_attention\, including support for symbolic tensor shapes via \IntVar\ and parameters for grouped query attention (GQA) and block-sparse masking. It also exposes helper functions and constants like \activate\_flash\_attention\_impl\, \sdpa\_kernel\, and \WARN\_FOR\_UNFUSED\_KERNELS\, enabling static type checkers to validate usage of these attention mechanisms.

tensor-shapes/pyrefly-jax-stubs/jax-stubs/lax, tensor-shapes/pyrefly-torch-stubs/torch-stubs/nn/attention · high confidence

Bundled boto3 type stubs for static analysis

Pyrefly now includes bundled type stubs for the boto3 library, enabling static type checking for AWS SDK usage. This addition provides type annotations for the core boto3 session, resource models, and high-level interfaces for services such as DynamoDB (including condition expressions and type serialization) and S3 (including transfer configurations and file operations). A LICENSE file for the stubs is also included in the bundle.

_crates/pyrefly\_bundled/third\party/stubs/boto3-stubs · high confidence

Bundled typeshed now includes third-party stubs

The pyrefly\_bundled crate has been restructured to embed third-party type stubs alongside the standard library. The build script now creates separate compressed archives for stdlib and third-party stubs, allowing the binary to provide type information for external packages without requiring external files at runtime. This change ensures that import resolution can access both stdlib and third-party type definitions from the bundled binary.

_crates/pyrefly\bundled · high confidence

Enhanced module export analysis with deprecation, docstring, and nested symbol support

The export analysis engine now provides richer metadata for module symbols. Users will see deprecation warnings for symbols marked with the \@deprecated\ decorator, including the specific message provided in the decorator. Docstrings for module-level and exported symbols are now tracked and available for hover and completion features. Additionally, the system now builds a flat table of nested workspace symbols (such as methods and nested classes) for first-party modules, improving the accuracy of symbol navigation and search within complex codebases.

pyrefly/lib/export · high confidence

Initial JSON Schema definitions for Pyrefly configuration files

This change introduces JSON Schema definitions for Pyrefly's configuration files, providing validation, autocomplete, and documentation support for both standalone \pyrefly.toml\ and the \\[tool.pyrefly\]\ section in \pyproject.toml\. The schemas cover all current configuration options, including error severity settings, project includes/excludes, Python platform and version settings, import handling, baseline configuration, and build system settings. The schemas are designed to work with modern editors like VS Code (via the Even Better TOML extension) and PyCharm, and include test files and a validation script to ensure schema correctness.

schemas · high confidence

Initial public release of the Pyrefly website

The Pyrefly website (pyrefly.org) is now publicly available, providing comprehensive documentation, installation guides, and a WebAssembly-based interactive sandbox for testing type checking. The site includes introductory and technical blog posts detailing the tool's performance, IDE integration, and ecosystem contributions, such as improving NumPy's type completeness. It is built with Docusaurus and includes configuration for formatting, testing, and deployment.

website · high confidence

Initial release of the Pyrefly VS Code extension

This change introduces the Pyrefly VS Code extension, which replaces Pylance to provide Python language features such as inline type errors, go-to definition, and hover information. The extension uses the Pyrefly binary for analysis and includes configuration options like \typeCheckingMode\ to select type-checking presets, \disableTypeErrors\ to suppress diagnostics, and \disableLanguageServices\ to toggle specific LSP capabilities. It also adds a command to infer and write type annotations for the current file.

lsp · high confidence

Introduce CinderX type report with structured type table and human-readable display

Added a new CinderX type report system that walks the AST to collect per-expression inferred types, storing them in a deduplicated \TypeTable\ of structured entries (classes, callables, bound methods, variables, literals, and other forms) and mapping source locations to table indices. The report includes support for contextual types (e.g., for \\_\static\\_\ primitives) and facet narrowing mismatches, and provides a human-readable \.txt\ display alongside the JSON output for debugging.

pyrefly/lib/report/cinderx · high confidence

Introduce DataFrame schema support and typing.\_Alias resolution

Added explicit type modeling for DataFrame schemas (including Polars and Pandas) with column-level dtype tracking and completeness checks, enabling more precise type inference for data manipulation libraries. Additionally, added a new module to resolve \typing.\_Alias\ definitions (such as \List\, \Dict\, \Set\) to their concrete builtin equivalents (\list\, \dict\, \set\), improving accuracy for standard library type aliases.

_crates/pyrefly\types/src · high confidence

Introduce Glean report generation for Python code analysis

Added a new \convert.rs\ module in \pyrefly/lib/report/glean\ that transforms pyrefly's internal AST and type information into Glean schema facts. This enables users to generate structured reports containing cross-references (xrefs), definitions, imports, and file metadata, with support for resolving symlinks and normalizing paths for consistent cross-platform keys.

pyrefly/lib/report/glean · high confidence

Introduce Pyrefly JAX shape stubs with testing and coverage tooling

This change adds the \pyrefly-jax-stubs\ package, providing shape-aware type stubs for the JAX library to enable static analysis with Pyrefly. The stubs cover array creation, broadcasting, matrix multiplication, reshaping, transposing, reductions, and elementwise activations, utilizing the type-level DSL for shape rules. Alongside the stubs, the package includes configuration files (\pyrefly.toml\, \stub\_coverage.toml\), a test runner (\run\_pyrefly.py\) to validate the stubs against Pyrefly, a runtime test runner (\run\_runtime\_tests.py\) to execute tests against the actual JAX library, and a suite definition (\suites.py\) to manage test discovery and expectations.

tensor-shapes/pyrefly-jax-stubs · high confidence

Introduce Pyrefly NumPy stubs package with shape-aware type checking and coverage tools

This change adds a new PEP 561 stub-only distribution (\pyrefly-numpy-stubs\) that provides NumPy type stubs with array shape information for Pyrefly, allowing static checks to discover shape-aware stubs without shadowing the runtime NumPy package. It includes a runner script (\run\_pyrefly.py\) to type-check NumPy shape-stub suites, a runtime test runner (\run\_runtime\_tests.py\) to execute suites against the real NumPy library, and a stub coverage inspection tool (\stub\_coverage.toml\) to verify coverage of specific NumPy members like \ndarray\. The package is configured to depend on \pyrefly-shape-extensions\ and uses a shared test harness to validate both type-checking errors and runtime behaviors.

tensor-shapes/pyrefly-numpy-stubs · high confidence

Introduce Pyrefly Torch stubs package with shape-aware type checking

This change adds a new PEP 561 stub-only distribution (\torch-stubs\) that provides PyTorch type stubs with tensor shape information for the Pyrefly static type checker. The package installs alongside the runtime \torch\ package without shadowing it, enabling users to perform static checks on their code using shape-aware annotations. The diff includes the package metadata, a configuration file (\pyrefly.toml\), and test runners (\run\_pyrefly.py\, \run\_runtime\_tests.py\) that allow users to validate their code against the new stubs. It also introduces a stub coverage inspection tool (\stub\_coverage.toml\) and opt-in support for \jaxtyping\ integration, allowing developers to verify that their PyTorch code adheres to the new shape constraints.

tensor-shapes/pyrefly-torch-stubs · high confidence

Introduce Pyrefly type stubs with precise shape inference for PyTorch

This change adds a new set of comprehensive type stubs for PyTorch (located in \torch-stubs/\) that enable precise shape inference for static type checkers. The stubs define type-level shape rules in \\shapes.pyi\ and apply them across the main \\\init\\_.pyi\, \fft.pyi\, \linalg.pyi\, and \return\_types.pyi\ modules. Users benefit from improved type-checking accuracy for tensor operations, including correct output shapes for FFT, linear algebra, and reduction functions, as well as proper handling of named return types and partial package resolution via \py.typed\.

tensor-shapes/pyrefly-torch-stubs/torch-stubs · high confidence

Introduce Type Server Protocol (TSP) crate with snapshot-aware type queries

The new \tsp\_types\ crate establishes the core type definitions and utilities for the Type Server Protocol. It introduces a \snapshotChanged\ notification mechanism, allowing clients to handle stale state, and defines request parameters for \getComputedType\, \getDeclaredType\, and \getExpectedType\ that include a snapshot version for consistency checks. The protocol supports querying types via either a simple \Node\ (URI and range) or a \Declaration\ (containing a nested node and extra metadata), enabling more precise type resolution for call expressions and other constructs.

_crates/tsp\types/src · high confidence

Introduce Type Server Protocol (TSP) v0.2.0 definition and generator

This change adds the Type Server Protocol (TSP) version 0.2.0 specification and the tooling to generate Rust bindings from it. The \tsp.json\ file defines the protocol's enumerations (such as \TypeFlags\ and \DeclarationCategory\), structures, and requests (including \typeServer/connection\, \typeServer/getComputedType\, \typeServer/getDeclaredType\, and \typeServer/getExpectedType\). The \generate\_protocol.py\ script uses the \lsprotocol\ generator infrastructure to convert these JSON definitions into a Rust \protocol.rs\ file, enabling the type server to communicate with clients using this new protocol.

_crates/tsp\_types/protocol\generator · high confidence

Introduce automated issue ranking pipeline

Adds a new \scripts/issue\_ranker\ module that automates the collection, enrichment, and LLM-based ranking of GitHub issues. The pipeline fetches issues via the GitHub GraphQL API, extracts and repairs code snippets, runs type checkers (pyrefly, pyright, mypy) with automatic dependency resolution, and then applies a 5-pass LLM ranking process (categorization, primer impact, dependency analysis, scoring, and final ranking) to prioritize issues by strategic value.

_scripts/issue\ranker · high confidence

Introduce build-system-backed source database and module resolution

The \pyrefly\_build\ crate now provides a new source database layer that integrates with build systems (Buck2 and custom) to supply module information. This change introduces a \SourceDatabase\ trait and a \BuildSystem\ configuration structure, allowing the type checker to query build-system targets for module paths and handles. It also updates the module resolver to support PEP 561 partial stub packages and improves namespace package detection by caching \pkgutil\ checks, ensuring more accurate import resolution when build-system-provided data is available.

_crates/pyrefly\build/src · high confidence

Introduce bundled stubs for typeshed and third-party packages

The module finder now supports resolving type hints from stubs embedded directly in the binary via a new \BundledStub\ trait and \Bundle\ data structure. This enables the type checker to provide type information for the Python standard library and third-party packages (including \typeshed\ third-party stubs and other \-stubs\ packages) without requiring them to be installed on the user's system, while maintaining correct precedence over site-packages and handling \py.typed\ markers appropriately.

pyrefly/lib/module · high confidence

Introduce configuration presets and structured error severity management

Pyrefly now supports named configuration presets (Off, Basic, Legacy, Default, Strict, All) that allow users to select a base set of error severities and behavior settings, which can be further overridden by explicit configuration. This change introduces a structured \ErrorDisplayConfig\ system that manages error severities, supports deprecated alias lookups, and handles merging of user overrides against preset defaults. Additionally, the configuration system now includes dedicated modules for environment argument parsing, interpreter querying, and config file discovery, providing a more robust foundation for managing type-checking behavior across different project setups.

_crates/pyrefly\config/src · high confidence

Introduce literal-preserving Flag type parameters for shape extensions

Pyrefly now supports \Flag\ type parameters that preserve the literal value of their designated value parameter (e.g., \Literal\[True\]\ instead of just \bool\). This allows shape stubs to pass preserved literals to type-level DSL functions, avoiding the need for separate overloads for every option value. The implementation includes a new \FlagDomain\ representation with explicit members (Int, Bool, Str, IntTuple, NoneType) and an \Index\ restriction, integrated into the type variable restriction system.

_crates/pyrefly\_types/src/type\var · high confidence

Introduce mypy primer error message classifier

A new CLI tool at scripts/primer\_classifier has been added to automatically classify mypy\_primer diff output for pyrefly pull requests. The classifier parses primer diff files and uses an LLM to categorize errors, with options to fetch source code for context, generate aggregate fix suggestions, and cross-check pyrefly errors against mypy and pyright results. Output can be rendered as JSON or Markdown, and the tool returns a non-zero exit code if regressions are detected, making it suitable for CI integration.

_scripts/primer\classifier · high confidence

Introduce new pyrefly subcommands and restructure the command-line interface

The command-line interface has been reorganized to expose new capabilities and improve usability. A new \pyrefly coverage\ command group has been added, splitting the previous \pyrefly report\ functionality into \pyrefly coverage report\ (with \pyrefly report\ now deprecated) and a new \pyrefly coverage check\ command to enforce minimum type-coverage thresholds. The \pyrefly init\ command now supports a \--dry-run\ flag for safe previews and a \--print-config\ flag to output the generated configuration to stdout. Additionally, dedicated commands for build-system integration (\pyrefly buck-check\ and \pyrefly bazel-check\) and a new \pyrefly snippet\ command for checking Python code snippets have been added to the main command enum.

pyrefly/lib/commands · high confidence

Introduce pyrefly\_python crate with Python-specific utilities

A new \pyrefly\_python\ crate has been created to house Python-specific logic previously scattered across the codebase. This includes AST parsing helpers, comment section and folding range detection, docstring cleaning, dunder method definitions, ignore comment parsing, keyword handling, and module management. This change consolidates Python-specific functionality into a dedicated module.

_crates/pyrefly\python · high confidence

Introduce shape-aware type solving with Int and IntTuple domains

The solver now supports shape-specific type variables, allowing it to reason about array dimensions and tuple shapes. This change adds dedicated handling for \Int\ (dimension) and \IntTuple\ (shape) types, including normalization of dimension expressions, preservation of gradual sizes, and canonicalization of shape tuples. It enables the type checker to validate shape constraints in generic code, such as ensuring that type variables bounded by \Int\ or \IntTuple\ are solved to valid dimension values, and supports structural shape matching for shaped arrays.

pyrefly/lib/solver · high confidence

Introduce the Type Server Protocol (TSP) with multi-connection support

This change introduces the Type Server Protocol (TSP), a new protocol layer that allows external clients to query type information (such as declared, computed, and expected types) and manage workspace snapshots independently of the main LSP connection. The implementation in \pyrefly/lib/tsp\ adds a \TspServer\ and \TspConnection\ architecture that supports multiple simultaneous connections via IPC, handles snapshot versioning to ensure consistency, and provides specific request handlers for type resolution and import resolution. It also includes a robust type conversion system that maps internal pyrefly types to TSP protocol types, ensuring correct encoding of standard library classes and handling edge cases like Jupyter notebook URIs.

pyrefly/lib/tsp · high confidence

Introduces type-level shape DSL and TorchScript compatibility layer

Adds a new internal DSL for defining shape types (dsl.py) with support for integer tuples, einsum/einops operations, and gufunc broadcasting, alongside a TorchScript compatibility module (torchscript.py) that strips shape annotations from source code at import time to enable scripting. This change also marks the package as typed via py.typed.

_tensor-shapes/pyrefly-shape-extensions/shape\extensions · high confidence

Migrate mypy and pyright configuration files to Pyrefly

Pyrefly now automatically detects and migrates existing configuration from mypy (mypy.ini or \[tool.mypy\] in pyproject.toml) and pyright (pyrightconfig.json or \[tool.pyright\] in pyproject.toml, including basedpyright) into its own config format. This covers migrating project includes/excludes, error codes, import handling, Python interpreter and version settings, and platform configurations, allowing users to transition their type-checking setup without manual reconfiguration.

_crates/pyrefly\config/src/migration · high confidence

Migrate mypy configuration files to Pyrefly

Users can now automatically convert existing mypy configuration files (both \mypy.ini\ and \pyproject.toml\) into Pyrefly's native configuration format. The migration tool parses mypy-specific settings such as project includes/excludes, search paths, Python platform/version, and error codes, translating them into the corresponding Pyrefly config options. It also handles mypy-specific features like the \$MYPY\_CONFIG\_FILE\_DIR\ variable expansion and converts mypy's regex-based exclude patterns into Pyrefly's glob-based patterns.

_crates/pyrefly\config/src/migration/mypy · high confidence

New LSP code actions and refactoring capabilities

The language server now exposes several new code actions and refactoring features. Users can convert modules to packages and vice versa via the 'Convert module to package' and 'Convert package to module' actions. A new 'Move symbol to new file' action allows moving selected code into a new file, with proper handling for existing target files. Additionally, the server now provides code lenses for running main functions and tests, enabling direct execution from the editor.

_pyrefly/lib/lsp/non\wasm · high confidence

New LSP quick fixes and refactorings

This update introduces a suite of new code actions for the LSP interface. Users can now add missing \@override\ decorators, assert that values are not \None\, and convert dictionary literals into TypedDicts, dataclasses, or Pydantic models. Refactoring capabilities include extracting code into variables, functions, fields, or new superclasses, as well as changing function signatures by removing or reordering parameters. Additional fixes allow converting star imports to explicit imports, replacing string literals with enum members, and narrowing types using \is not None\ checks.

_pyrefly/lib/state/lsp/quick\fixes · high confidence

New PyTorch and micro benchmarks for performance regression testing

The \pyrefly/benches\ directory now includes a comprehensive benchmark suite to monitor performance. It features real-world benchmarks over a pinned PyTorch checkout (15k+ files) measuring cold-start, error propagation, workspace symbols, full-check throughput, and indexed memory usage, alongside a separate target for memory reporting. Additionally, microbenchmarks using the Criterion harness have been added to measure specific type-checking behaviors such as enum resolution, exhaustiveness, and generic constructor solving, as well as a TSP benchmark to verify solve-reuse for unopened files. A helper script and pinned revision file manage the PyTorch source checkout for both internal (Buck) and OSS (Cargo) builds.

pyrefly/benches · high confidence

New PyTorch model examples with tensor shape type annotations

Added annotated example implementations for multiple PyTorch models—including APG, Background Matting, BERT, DCGAN, Deep Recommender, Demucs, DenseNet, DLRM, and DRQ—adapted from TorchBenchmark. These files demonstrate the pyrefly shape type system by explicitly tracking tensor dimensions (batch, channels, spatial size) through complex operations like convolutions, upsampling, dense connections, and feature interactions, providing concrete reference patterns for users.

tensor-shapes/pyrefly-torch-stubs/examples · high confidence

New Pyrefly change scoring skill

Added a new skill named 'score-pyrefly-change' that provides a structured checklist and scoring system for evaluating changes to Pyrefly. The skill includes a detailed markdown template for generating scorecards across Design, Implementation, Validation, Code Quality, and Reviewability dimensions, along with a Python script to compute weighted quality scores from verdicts.

.agents/skills/score-pyrefly-change · high confidence

New TSP type and import resolution requests

The TSP server now exposes several new requests to support richer type information and import resolution: \typeServer/getComputedType\ returns the inferred type at a position (accounting for control-flow narrowing), \typeServer/getDeclaredType\ returns the explicit annotation, and \typeServer/getExpectedType\ returns the contextually expected type (falling back to computed type when no context applies). Additionally, \typeServer/resolveImport\ resolves absolute and relative Python imports to their file URIs, \typeServer/getPythonSearchPaths\ returns the directories used for import resolution (including notebook-aware path resolution), \getSnapshot\ exposes the current state epoch, and \getSupportedProtocolVersion\ reports the supported TSP protocol version.

pyrefly/lib/tsp/requests · high confidence

New V1 issue ranking pipeline with multi-pass LLM analysis

The issue ranker now uses a five-pass pipeline to prioritize GitHub issues for pyrefly. Pass 1 uses Haiku to categorize issues; Pass 2 matches them against primer error data using deterministic and LLM-assisted fuzzy matching; Pass 3 uses Opus to identify dependency groups, blocking chains, and duplicates; Pass 4 scores each issue 0–100 using Sonnet based on weighted signals like false-positive impact, performance, and strategic adoption; and Pass 5 produces the final ranked list and priority tiers using Opus. This replaces previous ad-hoc ranking with a structured, signal-driven approach.

_scripts/issue\ranker/passes · high confidence

New WASM-specific LSP implementation for completions, hover, and inlay hints

This change introduces a new set of Rust modules in \pyrefly/lib/lsp/wasm\ that implement the LSP protocol features required for the WASM build. The new \completion.rs\ module provides completion ranking logic, auto-import support, and keyword handling. The \hover.rs\ module adds hover functionality, including Sphinx cross-reference resolution and type source display. The \inlay\_hints.rs\ module implements type annotation inlay hints with automatic import insertion. Additionally, \notebook.rs\ adds support for Jupyter notebook document synchronization, \provide\_type.rs\ implements an experimental custom LSP method for type resolution, \semantic\_tokens.rs\ handles semantic token generation, \signature\_help.rs\ provides function signature assistance, and \type\_source.rs\ tracks and displays the origin of inferred types.

pyrefly/lib/lsp/wasm · high confidence

New \`pyrefly coverage check\` command with strict mode and threshold enforcement

The \pyrefly coverage\ command now includes a \check\ subcommand that gates type-annotation coverage against a configurable threshold. Users can set a minimum coverage percentage via \--fail-under\ (defaulting to 100%) to fail the command if coverage drops below that level. A new \--strict\ flag allows users to treat \Any\-resolved annotations as untyped, providing a stricter measure of coverage. The command also supports \--public-only\ to restrict checks to symbols reachable from public modules and \--output-format\ to control how untyped-symbol findings are displayed.

pyrefly/lib/commands/coverage · high confidence

New diagnostic and analysis report formats

The report module now includes several new output formats for debugging and integration: a binding memory report that tracks the count and size of bindings per module, a dependency graph report mapping module paths to their dependencies, a CinderX report providing structured type data and class metadata for the CinderX compiler, a Glean report for telemetry, a PySA report for security analysis, and a trace report showing types and definitions for expressions. Additionally, the debug info output has been refactored to use the Answers system and is formatted to be more easily diffable.

pyrefly/lib/report · high confidence

New experimental programmatic type-checking API for embedders

An experimental, non-stable API is now available in the \pyrefly\ library to allow embedders (such as sandboxed interpreters or REPLs) to perform type checking programmatically. The new \Checker\ struct provides a reusable, warm state that amortizes the typeshed load, enabling efficient 'source in, diagnostics out' checks against in-memory modules without requiring the full editor-oriented playground. This interface is intended for internal or experimental use and may change without notice during minor version increments.

pyrefly/lib · high confidence

New isolated crate for Glean schema definitions

A new \pyrefly\_glean\_schema\ crate has been added to isolate generated Glean schema data from core builds. This crate provides Rust types and serialization logic for Glean reports, including schema definitions for Python indexing (such as cross-references, variable declarations, and types) and source file metadata (like file digests and content).

_crates/pyrefly\_glean\schema · high confidence

New pyrefly\_graph crate for thread-safe graph calculations

The \pyrefly\_graph\ crate has been introduced to handle graph-based calculations with a focus on thread safety and performance. It provides a \Calculation\ type that allows multiple threads to compute values in parallel (e.g., for mutually recursive dependencies) without deadlocking, using atomic status tracking and write-locking for result publication. The crate also includes an \Index\ and \IndexMap\ for efficient, type-safe key management within the graph structure.

_crates/pyrefly\graph · high confidence

New scope-aware AST visitor and call graph infrastructure for Pysa reports

The Pysa reporting module now includes a new scope-aware AST visitor (\ast\_visitor.rs\) and a comprehensive call graph builder (\call\_graph.rs\) that parse Python source to extract function definitions, class structures, captured variables, and global variables. This infrastructure introduces detailed scope tracking (distinguishing exported vs. non-exported functions/classes, decorators, and type parameters) and builds a rich call graph with specific origin kinds for various Python constructs (e.g., augmented assignments, subscript operations, for-loop iterations, and decorator targets). The changes also add support for serializing class definitions, function signatures, and captured variable information into the Pysa report format, enabling more precise taint analysis by understanding the full context of function calls and variable usage within modules.

pyrefly/lib/report/pysa · high confidence

New scripts for type-checker comparison, release notes, and issue ranking

This change introduces a suite of new automation scripts in the \scripts/\ directory. The \compare\_typecheckers.py\ script now supports comparing pyrefly, pyright, and mypy across multiple projects, with sharding support for parallel execution and a new \--output-json\ flag for detailed error reporting. A new \generate\_release\_notes.py\ script automates the creation of release notes by aggregating commits and issues via the GitHub API and using an LLM to polish the output, including a disclaimer for dev releases. Additionally, an \issue\_ranker\ module with LLM-based classification and scoring is added, along with integration tests for the LLM transport layer and issue fetching utilities.

scripts · high confidence

New skill for porting PyTorch models to pyrefly tensor shape types

A new skill, \add-shape-types-to-torch-model\, has been added to guide the porting of PyTorch models to use pyrefly's tensor shape type system (e.g., \Tensor\[\[B, C, H, W\]\]\). This skill provides a gated workflow for annotating model forward methods, preserving jaxtyping precision, and handling shape tracking via stubs, DSL functions, and special handlers. It includes documentation on porting principles, shape tracking capabilities, and a style guide, along with a verification script (\verify\_port.sh\) to audit ports for issues like bare \Tensor\ annotations and missing \assert\_type\ checkpoints.

tensor-shapes/skills · high confidence

New stubgen module for generating .pyi stub files

The \pyrefly/lib/stubgen\ directory now contains the core logic for generating Python stub files. The \extract.rs\ module walks the module's AST and uses solved type answers to build a structured \ModuleStub\ representation, while \emit.rs\ renders this structure into valid \.pyi\ text, handling imports, classes, functions, variables, and type aliases.

pyrefly/lib/stubgen · high confidence

New test harness and stub coverage inspection tool for tensor-shapes

The tensor-shapes area now includes a unified test runner (\run\_all\_shape\_tests.py\ and \run\_tests.py\) that executes both static type-checking and runtime shape tests for PyTorch, NumPy, JAX, and einops stubs, alongside a new \stub\_coverage.py\ tool that inspects and reports gaps between the shipped \.pyi\ stubs and the actual runtime libraries. These changes are supported by a bootstrapping script (\bootstrap\_venv.py\) that creates a shared Python 3.13 virtualenv with pinned dependencies (NumPy 2.5.0, JAX 0.11.2, PyTorch 2.12.1+cpu) and a suite of unit tests (\test\_run\_tests.py\, \test\_stub\_coverage.py\) validating the new infrastructure.

tensor-shapes · high confidence

New utility library for path resolution, file watching, and globbing

The \pyrefly\util\ crate now provides a suite of shared utilities for the Pyrefly toolchain. This includes an \Absolutize\ trait for robust path resolution and relative path computation, a \CategorizedEvents\ struct to filter and categorize file watcher events (excluding \\\pycache\\_\ and stdlib files), and a \Glob\ implementation that supports \.py\, \.pyi\, \.pyw\, and \.ipynb\ files while respecting \.gitignore\ and \.ignore\ rules. Additional helpers include \ArcId\ for pointer-based identity, \InternedPath\ for efficient path storage, and \LinedBuffer\ for handling source positions and notebook cell mappings.

_crates/pyrefly\util · high confidence

Pyrefly 1.4.0-dev.2 release with new developer tooling and documentation

This release updates the version to 1.4.0-dev.2 and introduces several new files to support the development workflow and project structure. It adds \AGENTS.md\ with comprehensive guidance for AI coding agents, \REVIEW.md\ for code review instructions, and \ARCHITECTURE.md\ detailing the type checker's design. Developer tooling is enhanced with \ruff.toml\ for Python formatting, \rustfmt.toml\ for Rust formatting, and \rust-toolchain.toml\ specifying the stable Rust toolchain with clippy and rustfmt components. The repository also includes a new GitHub Action (\action.yml\) for type checking, a \debug.html\ interface for debugging bindings, and updated \README.md\ and \CONTRIBUTING.md\ files reflecting the new project status and contribution guidelines.

(repo-wide) · high confidence

Pyrefly VS Code extension introduces new interactive features and improved environment handling

The extension now provides runnable code lenses for executing tests and main functions directly from the editor, supports docstring folding via a dedicated command, and offers hover tooltips with +/- controls to adjust verbosity levels. It also integrates with the Python extension ecosystem by preferring the vscode-python-environments API when available, automatically disabling conflicting language servers like Pyright, and displaying build system status in the status bar.

lsp/src · high confidence

Pyrefly WASM sandbox exposes full language service API

The pyrefly\_wasm crate now provides a comprehensive JavaScript API for the browser-based sandbox, enabling features like multi-file editing, hover information, semantic tokens, go-to-definition, autocomplete, and inlay hints. The WASM module exports a State object with methods such as updateSandboxFiles, hover, semanticTokens, gotoDefinition, autoComplete, and inlayHint, allowing the frontend to interact with the Pyrefly type checker and language server capabilities directly in the browser.

_pyrefly\wasm · high confidence

Shape-aware stubs for JAX NumPy, FFT, and Linear Algebra modules

The \jax-stubs/numpy\ package now includes comprehensive type stubs for \jax.numpy\, \jax.numpy.fft\, and \jax.numpy.linalg\ that preserve tensor shapes through operations. By importing shape-inference functions from \jax.\_shapes\ (such as \matmul\_shape\, \fft\_shape\, and \cholesky\_shape\), these stubs allow static type checkers to verify the dimensions of output arrays based on input shapes, covering array creation, elementwise operations, reductions, FFTs, and linear algebra routines.

tensor-shapes/pyrefly-jax-stubs/jax-stubs/numpy · high confidence

Shape-aware type stubs for NumPy linear algebra functions

Added type stubs for the \numpy.linalg\ module that model tensor shapes using the new \Int\ and \IntVar\ DSL. This provides shape inference for functions like \solve\, \norm\, \eigh\, and \svd\ (restricted to reduced SVD), while preserving standard re-exports from the underlying NumPy implementation.

tensor-shapes/pyrefly-numpy-stubs/numpy-stubs/linalg · high confidence

Support for Buck2 and custom source DB queriers

Users can now query source databases using Buck2 or arbitrary custom commands. The new Buck2 querier supports resource isolation via systemd cgroups in fbcode environments and passes build IDs to the query process. Additionally, a custom querier allows users to define their own command-line tools for source DB queries, with support for shared repository roots.

_crates/pyrefly\build/src/query · high confidence

Support running pyrefly as a Python module

Users can now invoke pyrefly using \python -m pyrefly\ (and \py -m pyrefly\ on Windows). This change adds a \\_\main\\.py\ entry point that locates the installed pyrefly executable and runs it, while also exposing a \\\version\\_\ attribute in the package for programmatic access to the version number.

pyrefly/python · high confidence

Architecture

Extracted reusable LSP test harness into a separate crate

The in-process LSP test infrastructure has been extracted from the main \pyrefly\ crate into a new, standalone \pyrefly\_lsp\_test\ crate. This change allows both the \lsp\_interaction\ tests and the \pyrefly\ benchmarks to share a common \TestClient\ harness that spawns the language server on a thread and communicates via in-memory channels, while also resolving potential type mismatches by re-exporting specific LSP types from the main crate.

_crates/pyrefly\_lsp\test · high confidence

Behavioural changes

1421 commits (162 fixes) modifying pyrefly/lib/alt/class

A change to existing behaviour in pyrefly/lib/alt/class — 1421 commits (162 fixs), 20 files.

pyrefly/lib/alt, pyrefly/lib/alt/class, pyrefly/lib/binding · medium confidence · unverified

Enhanced code intelligence for Python dictionaries, non-Python modules, and pytest fixtures

This update improves the LSP experience in three key areas. First, dictionary key autocompletion is now more robust, correctly handling TypedDict keys in \.get()\ calls, discriminated unions, and empty subscripts, while also supporting Polars DataFrame column names in function calls. Second, go-to-definition now works for symbols in non-Python source files (such as \.thrift\ files) by performing text-based symbol searches when standard parsing is not possible. Third, navigation support has been added for pytest fixtures, allowing users to jump from fixture parameters to their definitions and vice versa.

pyrefly/lib/state/lsp · high confidence

Improved Pyrefly binary discovery within the selected Python environment

The LSP resources now include a dedicated script to locate the \pyrefly\ binary that is installed in the user's currently selected Python environment. This script prioritizes binaries found within the active virtual environment over those installed globally or in other locations, ensuring that the language server uses the correct version of Pyrefly associated with the project's environment. Tests verify that the discovery logic correctly ignores binaries outside the selected environment and handles cases where Pyrefly is not installed.

lsp/resources · high confidence

Introduce structured type-table API with structural hashing

The \type\_table\ query now returns a new structured format (\TypeTableResponseData\) containing deduplicated type shapes (\IndexedTypeShapeKind\) alongside a location-to-index mapping (\types\). Each shape entry includes a stable structural hash, enabling clients to cache parsed types across files and requests. The API supports serializing named types, callables (including staticmethod flags), and type variables, while dropping the previous per-location display strings in favor of this compact, hash-based representation.

pyrefly/lib/query · high confidence

Major overhaul of error reporting, baseline matching, and suppression logic

The error handling subsystem has been significantly refactored to improve diagnostic clarity and baseline management. Error messages now include structured details, secondary annotations for richer context (such as operand types in binary operations), and support for quick fixes. Baseline matching has been enhanced with configurable modes (column-ordered and concise-description) and the ability to record severity thresholds, ensuring stable comparisons across runs. Suppression logic has been refined to better handle f-strings, inline ignores, and the removal of unused suppressions, while output formats now include severity levels and support for CodeClimate integration.

pyrefly/lib/error · high confidence

Proc-macro derive macros now support lifetime parameters

The \TypeEq\, \Visit\, and \VisitMut\ derive macros in the \pyrefly\_derive\ crate have been updated to handle generic lifetime parameters on structs and enums. Previously, these macros likely failed or produced incorrect code when applied to types with lifetimes; now they correctly propagate lifetimes in the generated trait implementations, allowing users to derive these traits on lifetime-generic types without manual implementation.

_crates/pyrefly\derive · high confidence

Refactor LSP module path resolution and platform-specific module exports

The LSP module handling has been restructured to improve how bundled type stubs (such as typeshed and third-party stubs) are resolved to real file paths and to separate platform-specific module exports. A new \module\_helpers.rs\ file introduces \to\_real\_path\ to convert internal \ModulePath\ details (including \BundledTypeshed\, \BundledTypeshedThirdParty\, and \BundledThirdParty\) into user-visible \PathBuf\ objects, falling back to None for WebAssembly builds where disk access is unavailable. It also provides \collect\_symbol\_def\_paths\ to gather definition locations for type symbols, ensuring bundled types are correctly mapped to their materialized disk paths. Additionally, the module structure is split into \non\_wasm.rs\ and \wasm.rs\ to conditionally export platform-specific modules (e.g., \server\, \workspace\ for non-WASM; \completion\, \hover\ for WASM), aligning the LSP server's public API with the target architecture.

pyrefly/lib/lsp · high confidence

Refactor module dirty tracking into lock-free atomic storage

The module state system now uses a new \AtomicComputedDirty\ structure to combine the computed epoch and dirty flags into a single \AtomicU64\. This change replaces separate atomic operations with a single compare-and-swap loop, ensuring that checking if data is stale and marking dependencies as dirty happens atomically. This eliminates race conditions in incremental dirty tracking and reduces lock contention during concurrent rechecks, resulting in more reliable and faster IDE responses when files change.

pyrefly/lib/state · high confidence

Refactored Python interpreter discovery and environment configuration

The Python environment configuration module has been restructured to improve interpreter discovery and environment handling. Interpreter querying is now isolated in its own module, caching stdlib paths for performance. The system now distinguishes between active environments (detected via VIRTUAL\_ENV or CONDA\_PREFIX) and project-level virtual environments, with optimized discovery for venvs in directory trees. Conda environment detection is restricted to the \<env\_name\>/bin directory. A new configurable \python-interpreter-find-command\ allows custom interpreter discovery scripts. The configuration schema now uses kebab-case field names (e.g., \python-interpreter-path\, \python-interpreter-find-command\) with backward compatibility aliases. Interpreter selection priority has been adjusted to give LSP/IDE-provided interpreters higher precedence than auto-discovered ones, while still respecting explicit CLI overrides.

_crates/pyrefly\config/src/environment · high confidence

Refactored source database architecture with new query and manifest handling

The source database implementation has been restructured to improve modularity and performance. A new \QuerySourceDatabase\ now manages target manifests, path lookups, and file watching patterns, replacing the previous monolithic approach. This change introduces a \SourceDbQuerier\ trait to decouple the query logic from the database state, allowing for more flexible integration with build systems like Buck. Additionally, a new \BuckCheckSourceDatabase\ handles manifest-based lookups for buck-check operations, filtering out Pyre typeshed stubs to prevent spurious errors. The \MapDatabase\ has been updated to use \Vec1\ for module paths, ensuring at least one path is always present, and the system now supports config overrides and default configurations supplied by the build system.

_crates/pyrefly\_build/src/source\db · high confidence

Refactored type system internals for class and function metadata

The type-checking engine in \pyrefly/lib/alt/types\ has been restructured to improve how class and function metadata is stored and accessed. A new \ClassBases\ struct now explicitly tracks direct base types, source ranges, and the first tuple ancestor, separating this data from general class metadata to prevent cyclic dependencies during type argument calculation. \ClassMetadata\ has been expanded to include detailed tracking for Pydantic models (including strict mode and validation flags), Django models and serializers, dataclass transforms, and disjoint-base status. Function handling has been split into \UndecoratedFunction\ (pre-decorator state) and \Decorator\ (post-decorator state), allowing for more precise analysis of special decorators like \@cached\_property\ and \@disjoint\_base\. Additionally, a new \Instance\ wrapper unifies class and TypedDict instances, and \YieldResult\ types have been migrated to use the new \TypeHeap\ factory methods.

pyrefly/lib/alt/types · high confidence

Support for bundled third-party type stubs

The pyrefly\_bundled crate now includes support for third-party type stubs alongside the standard library. Users benefit from improved resolution of third-party stub paths and more accurate package name recommendations, as the new code correctly handles the directory structure of typeshed's stubs (e.g., mapping \typeshed/stubs/package-name/...\ to the correct package context) and respects the \VERSIONS\ file for stdlib modules. This change also fixes bugs related to multiple versions of materialized bundled typeshed and ensures that third-party stubs are properly integrated into the bundled archive.

_crates/pyrefly\bundled/src · high confidence

Update conformance test suite to latest upstream Python typing specifications

The conformance test suite has been updated with new and revised test cases from the upstream Python typing repository. This includes comprehensive tests for PEP 695 generics (variance inference and \infer\_variance\), PEP 800 \disjoint\base\, \typing.Self\ attributes, and detailed validation of \dataclass\ behaviors (slots, frozen, inheritance, \\\_post\init\\\, \\\_match\args\\_\, and keyword-only arguments). It also adds coverage for \ClassVar\ restrictions, \NamedTuple\ class syntax, and \Annotated\/\Final\ qualifiers, ensuring the type checker aligns with the latest standard library specifications.

python · high confidence

Updated bundled typeshed stubs

The bundled typeshed stubs in the standard library have been updated to a newer version. This brings improved type checking coverage and accuracy for Python standard library modules, including updated signatures for modules like asyncio, csv, and codecs, as well as support for newer Python versions (up to 3.15 in some stubs).

_crates/pyrefly\_bundled/third\party/typeshed · high confidence

Fixes

Restored torch.nn submodules and added shape-aware type stubs

The \torch.nn\ package now correctly exposes its submodules (such as \init\, \functional\, \modules\, and \parallel\) as importable attributes, resolving previous issues where these were missing. Additionally, comprehensive type stubs have been added for \torch.nn.init\ and \torch.nn.functional\, providing shape-aware signatures for operations like convolution, pooling, and weight initialization to improve static type checking accuracy.

tensor-shapes/pyrefly-torch-stubs/torch-stubs/nn · high confidence

Test coverage

2991 commits adding/updating tests in pyrefly/lib/test; Add conformance test support for @deprecated warnings and enum member value inference; Added Glean schema test fixtures for Python analysis; Added LSP interaction tests for third-party stub behavior; Added Pydantic v2 stubs for type checking; Added comprehensive test coverage for Django type inference; Added comprehensive type-level shape tests for NumPy stubs; Added expect-style test fixtures for CinderX type inference; Added extension test suite for Pyrefly LSP behavior; Added integration tests for TSP server interaction; Added negative tests for static jaxtyping shape checking; Added runtime tests for tensor shape annotations and TorchScript compatibility; Added shape-stub tests for JAX tensor operations; Added test cases for unused parameter detection; Added test coverage for .pyi preference when .py is missing; Added test coverage for Polars schema and dtype inference; Added test coverage for Pydantic model configuration and validation behaviors; Added test coverage for attrs library integration; Added test coverage for functools.partial and functools.singledispatch; Added test coverage for jaxtyping static shape checking; Added test coverage for nested package imports with aliased submodules; Added test coverage for pyrefly coverage report edge cases; Added test coverage for untyped import recommendations; Added test coverage for unused type-ignore baselines; Added test files for unused import detection; Added test fixtures for LSP baseline hint behavior; Added test fixtures for auto-importing submodules; Added test fixtures for cross-file invalidation in project mode; Added test fixtures for deep submodule chains and external package access; Added test fixtures for module package conversion; Added test fixtures for multi-byte UTF-8 workspace symbols; Added test fixtures for relative import module resolution; Added test fixtures for relative import scenarios; Added test fixtures for safe delete file functionality; Added test fixtures for safe file deletion scenarios; Added test fixtures for workspace diagnostics configuration scenarios; Added test fixtures for workspace symbol preference of non-init modules; Added test for relative imports outside configured search paths; Added test infrastructure and type stubs for factory\_boy; Added test module for TSP request handlers; Added tests for SARIF output validation; Added tests for TSP protocol type serialization and construction; Added tests for moving symbols to new files; Added tests for non-Jupyter notebook support and exclusion rules; Added tests for pandas DataFrame type inference and stub correctness; Added tests for project-includes and project-excludes filtering; Added tests for untyped third-party stub handling; Added tests for version helper utilities; Added type stubs for the attrs library; Added unit tests for Pyrefly call graph and Pysa export logic; Added unit tests for issue ranker and typechecker comparison scripts; Expanded LSP interaction test coverage; Expanded LSP test coverage for core IDE features; Expanded LSP test coverage for inlay hints, diagnostics, and error suppression; Expanded Pyrefly test coverage for PyTorch tensor shapes; Expanded stubgen snapshot test coverage; Snapshot tests for type-checking laziness and demand trees.

Dependencies

Initial project scaffolding and dependency configuration

This change introduces the foundational build configuration for the Pyrefly project. It establishes a Rust workspace with 14 crates (including \pyrefly\, \pyrefly\_config\, \pyrefly\_lsp\_test\, and \tsp\_types\) and sets the Rust edition to 2024. It also adds the initial \Cargo.lock\, \package-lock.json\, and \pyproject.toml\ files, along with the \website/package.json\ for the Docusaurus-based documentation site. The configuration pins specific versions for core dependencies such as \serde\, \tokio\, \clap\, and \lsp\_types\ (via the \gen-lsp-types\ fork), and configures release profiles with LTO and debug info stripping.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 57 → 70 (+12.7)
  • Rubric changed (rubric-2026.09.9 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 79 → 75 (-4.2)
  • Architecture 98 → 93 (-5.0)
  • Maturity 66 → 66 (-0.2)
  • Readiness 80 → 74 (-6.5)
  • Security 35 → 67 (+32.1)
  • Event Sourcing 100 → 100 (+0.0)
  • Performance 94 (new)

Resolved (109)

  • AnswersSolver::check_attr_set_and_infer_narrow (cognitive 25) (pyrefly/lib/alt/attr.rs)
  • AnswersSolver::check_attr_set_and_infer_narrow (cyclomatic 17) (pyrefly/lib/alt/attr.rs)
  • AnswersSolver::check_class_attr_set_and_infer_narrow (cognitive 22) (pyrefly/lib/alt/class/class_field.rs)
  • AnswersSolver::check_class_attr_set_and_infer_narrow (cyclomatic 19) (pyrefly/lib/alt/class/class_field.rs)
  • AnswersSolver::enum_value_lookup_on_class (cognitive 16) (pyrefly/lib/alt/class/enums.rs)
  • AnswersSolver::parse_dimension_list_with_context (cognitive 18) (pyrefly/lib/alt/expr.rs)
  • AnswersSolver::parse_jaxtyping_annotation (cognitive 19) (pyrefly/lib/alt/jaxtyping.rs)
  • AnswersSolver::polars_select (cognitive 28) (pyrefly/lib/alt/polars_specials.rs)
  • AnswersSolver::polars_select (cyclomatic 19) (pyrefly/lib/alt/polars_specials.rs)
  • BindingsBuilder::stmt (cognitive 270) (pyrefly/lib/binding/stmt.rs)
  • BindingsBuilder::stmt (cyclomatic 140) (pyrefly/lib/binding/stmt.rs)
  • Boundary-crossing change coupling: map_db.rs ↔ playground.rs (crates/pyrefly_build/src/source_db/map_db.rs)
  • Documentation: no architecture or design documentation (website/README.md)
  • Documentation: no installation or build instructions (website/README.md)
  • Documentation: no usage examples (website/README.md)
  • Duplicated block (10 lines × 2) (crates/pyrefly_types/src/type_level_dsl.rs)
  • Duplicated block (10 lines × 2) (crates/pyrefly_types/src/type_level_dsl.rs)
  • Duplicated block (10 lines × 2) (pyrefly/lib/lsp/non_wasm/server.rs)
  • Duplicated block (10 lines × 2) (pyrefly/lib/solver/solver.rs)
  • Duplicated block (10 lines × 2) (pyrefly/lib/stubgen/extract.rs)
  • …and 89 more

New (274)

  • Ambiguous overlap in intent. includes returns Globs for a scope, while get_filtered_globs returns FilteredGlobs and takes custom_excludes. It is unclear if includes is a simplified version of get_filtered_globs with no custom excludes, or if they serve distinct filtering logic. The naming convention (includes vs get_filtered_globs) is inconsistent.
  • AnswersSolver::check_bool_expr_and_get_value (cognitive 16) (pyrefly/lib/alt/solve.rs)
  • AnswersSolver::check_except_clause_reachability (cognitive 23) (pyrefly/lib/alt/solve.rs)
  • AnswersSolver::check_except_clause_reachability (cyclomatic 17) (pyrefly/lib/alt/solve.rs)
  • AnswersSolver::compare_types (cyclomatic 16) (pyrefly/lib/alt/operators.rs)
  • AnswersSolver::parse_int_tuple_shape_args (cognitive 17) (pyrefly/lib/alt/expr.rs)
  • AnswersSolver::polars_output_count (cognitive 20) (pyrefly/lib/alt/polars_specials.rs)
  • AnswersSolver::polars_output_count (cyclomatic 19) (pyrefly/lib/alt/polars_specials.rs)
  • AnswersSolver::project_regular_nested_list (cognitive 24) (pyrefly/lib/alt/regular_nested_list.rs)
  • AnswersSolver::project_regular_nested_list (cyclomatic 18) (pyrefly/lib/alt/regular_nested_list.rs)
  • AnswersSolver::resolve_attr_setters (cognitive 16) (pyrefly/lib/alt/attr.rs)
  • AnswersSolver::resolve_class_attr_setter (cognitive 23) (pyrefly/lib/alt/class/class_field.rs)
  • AnswersSolver::resolve_class_attr_setter (cyclomatic 19) (pyrefly/lib/alt/class/class_field.rs)
  • BaselineIndex::apply (cognitive 20) (pyrefly/lib/error/baseline.rs)
  • BindingExpect::fmt (cyclomatic 21) (pyrefly/lib/binding/binding.rs)
  • BindingsBuilder::stmt_impl (cognitive 322) (pyrefly/lib/binding/stmt.rs)
  • BindingsBuilder::stmt_impl (cyclomatic 157) (pyrefly/lib/binding/stmt.rs)
  • BindingsBuilder::stmts (cognitive 21) (pyrefly/lib/binding/bindings.rs)
  • BindingsBuilder::stmts (cyclomatic 17) (pyrefly/lib/binding/bindings.rs)
  • DslValidator::validate_int_tuple_expression (cyclomatic 16) (crates/pyrefly_types/src/type_level_dsl.rs)
  • …and 254 more

Changes since last survey

  • 300 commits — 284 feature/other, 16 fixes

By area

  • tensor-shapes/pyrefly-torch-stubs — 101 commits
  • pyrefly/lib — 97 commits
  • tensor-shapes/pyrefly-jax-stubs — 39 commits
  • (root) — 13 commits
  • tensor-shapes/skills — 7 commits
  • crates/pyrefly_types — 6 commits
  • tensor-shapes/pyrefly-numpy-stubs — 5 commits
  • website/docs — 5 commits
  • .agents/skills — 3 commits
  • crates/pyrefly_bundled — 3 commits
  • website/docusaurus.config.ts — 3 commits
  • .github/workflows — 2 commits
  • conformance/third_party — 2 commits
  • tensor-shapes/microtorch — 2 commits
  • crates/pyrefly_build — 1 commit
  • crates/pyrefly_util — 1 commit
  • lsp/.vscode-test.mjs — 1 commit
  • lsp/package-lock.json — 1 commit
  • lsp/src — 1 commit
  • release_notes/release-notes-v1.3.2.md — 1 commit

Notable commits

  • fix: Add regression tests for stale Basic-mode indicator on pyrefly.toml watch events
  • fix: Back out "fix Refinement should not turn static types into gradual types #263"
  • fix: Easy bugfix: don't redefine torch.device
  • fix: Fix Stop stubgen retaining full analysis for the whole import closure (#4690)
  • fix: Fix false positive bad-instantiation on NewType over abstract classes (#5023)
  • fix: Fix stale Bluesky link on website
  • fix: add regression test for Callable[[X, *Ts], R] cannot be called with (x, *args) where args: tuple[*Ts] #4832 (#4950)
  • fix: fix Django Support: "pk" field has wrong type when using ForeignKey(…, primary_key=True) #4995 (#4996)
  • fix: fix Missing hover on attribute assignment in init #4986 (#4997)
  • fix: fix Respect VERSIONS file in typeshed #2535 (#3093)
  • fix: fix get overload with self-type Concatenate[ObjT, P1] + sibling TypeVar R1 still unmatched after #4415 #4592 (#4680)
  • fix: fix false bad-return for a generator function with Iterator[X] | T return annotation #4825 (#4827)
  • fix: fix imports using symlinked paths are not updated #1336 (#3029)
  • fix: fix pydantic - Strict types are not treated as strict mode #3543 (#3565)
  • fix: fix remove or downgrade the already appear branch in match case #3015 (#3179)
  • fix: fix(torch-stubs): return torch.return_types named tuples (#4916)
  • change: Accept None for matrix rank tolerance
  • change: Accept axis in Tensor mean reductions
  • change: Accept bare *S splats of IntTuple-bounded type variables
  • change: Accept bare *tuple[...] and *IntTuple` splats in shapes
  • …and 280 more

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

facebook/pyrefly was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 29 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 7a07950ab846c771f1d64188cb7daccd8319e464 — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-c4983f2d4e5c.