Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

pyrefly-shape-extensions

Runtime helpers for Pyrefly tensor shape annotations.

This package provides the lightweight shape_extensions module used by Pyrefly's tensor shape stubs. It defines runtime no-op versions of the shape typing primitives so annotations such as Tensor[[B, T]], IntVar("B"), and assert_shape(x.shape, (2, 3)) can be evaluated by Python while Pyrefly uses the corresponding stubs for static shape checking.

NamedInts and CaptureNamedInts carry named axis lengths from **kwargs into shape rules for einops-like APIs.

RegularNestedList[Shape, Domain] represents regular (non-jagged) nested list literals; for example, [[1, 2], [3, 4]] binds Shape to [2, 2]. Unsupported containers and irregular literals use ordinary typing and any fallback overload supplied by the consumer.

IntTupleOrList[Values] is a stub-authoring parameter type for APIs that accept integer tuples and lists. A direct, unstarred list literal such as [2, 3] binds Values to IntTuple[2, 3]; an existing or starred list remains gradual, while a direct literal containing a non-integer is rejected.

@shape_transform marks a type-level shape DSL function and is a runtime no-op. type_shape_dsl_function remains available as a backward-compatible alias.

The package is versioned in lockstep with Pyrefly.

Portable shape annotations

Shaped[T, "..."] is an alias for typing.Annotated, so other type checkers read T and ignore the shape string. Inside a @shape_vars function or class, Pyrefly also reads the string in annotations, casts, type aliases, and class bases. Use @shape_vars("") for a literal shape with no declared dimensions.

Legacy type aliases cannot capture dimensions declared on an enclosing @shape_vars function or class. For example, an Alias: TypeAlias = Shaped[Array, "[N]"] inside a @shape_vars("N") definition reports that N is not in scope for the alias. This is the same restriction that applies when legacy type aliases capture ordinary enclosing type parameters. Use the Shaped annotation directly in that scope; literal-only aliases are supported.

A defaulted @shape_vars("N") dimension after a *Ts class parameter is not supported: Pyrefly reports the declaration and can mistake a trailing ordinary type argument for the dimension. Pyrefly accepts @shape_vars("N", required=True) class Required[*Ts] with an explicit shape, as in Required[int, str, 3]; Required[int, str] still treats str as a dimension. This explicit specialization is specific to Pyrefly, not a portable workaround for other type checkers.

At runtime, Shaped[Base, "..."] can appear as a class base because Annotated resolves to Base. Pyrefly reads its shape. In Pyright 1.1.414, the base is rejected and inherited attributes and methods are inferred as Unknown downstream. Do not rely on this base spelling when Pyright users need inherited signatures.

Metadata

Release files for pyrefly-shape-extensions 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for pyrefly-shape-extensions 1.5.0
File Size Uploaded Provenance Actions
pyrefly_shape_extensions-1.5.0.tar.gz 15.0 kB With provenance Details for pyrefly_shape_extensions-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyrefly-shape-extensions 1.5.0
File Interpreter ABI Platform Actions
pyrefly_shape_extensions-1.5.0-py3-none-any.whl Python 3 none any Details for pyrefly_shape_extensions-1.5.0-py3-none-any.whl

Total release size: 32.9 kB

Release files / pyrefly_shape_extensions-1.5.0.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL pyrefly_shape_extensions-1.5.0.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d7fe59800b21afec150497954c57defc6fadc67dc8c8857337c2d93269a611b3
BLAKE2b-256 checksum
How to use checksums
52d4554353b9f9c40827ef88ecb532ad2682b53becc69451d6b3c6b2b7726da5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / pyrefly_shape_extensions-1.5.0-py3-none-any.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL pyrefly_shape_extensions-1.5.0-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c9e590ca6edcc658035c9560b588af533d25da553f82d3e4efbe9194710dd8f
BLAKE2b-256 checksum
How to use checksums
09cd7b4136c462815e87642c711f982ddc83a86e4bc03bc8afaadf38d06807d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for pyrefly-shape-extensions 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Change of provenance

The repository and configuration that created this release differ from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Repository

Select from 2 files

Attestation for pyrefly_shape_extensions-1.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page