Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ShapeScript

A typed tensor language that compiles to PyTorch. Axis names and sizes are part of the syntax, and the checker verifies every shape before any code runs. It's einops built into a language: no pattern strings, no dim=-1, no unsqueeze, and no dropping back into Python halfway through an expression.

dim D  = 768
dim H  = 12
dim Dh = D / H

fn causal_attention(x: [b n D], w_qkv: [D 3*D], w_o: [D D]) -> [b n D]:
    q, k, v = x @ w_qkv
        |> split(b n (3 H Dh) -> b H n Dh)

    att = einsum(q, k: b H n Dh, b H m Dh -> b H n m)
        |> scale(1 / sqrt(Dh))
        |> masked_fill(!causal[n m], -inf)
        |> softmax(over=m)

    return einsum(att, v: b H n m, b H m Dh -> b H n Dh)
        |> rearrange(b H n Dh -> b n (H Dh))
        |> matmul(w_o)

Swap two letters in the last einsum, writing b H m n for the attention weights, and PyTorch still runs it, since n and m have the same size. ShapeScript doesn't compile it: error E0408, the pattern calls axis 3 m, but m is axis 4.

This package is a pre-release. It has the compiler (shapescript), the language server (shapescript-lsp), the runtime, import of .ss files from Python and the notebook magic (%%shapescript), with prebuilt binaries for Linux (x86_64, aarch64), macOS (arm64, x86_64) and Windows (x64). It needs PyTorch:

pip install torch
pip install shapescript
shapescript check model.ss
import shapescript
shapescript.install()   # then `import model` loads model.ss

The editor support is the ShapeScript extension for VS Code, on the Visual Studio Marketplace, with the language server inside it: code --install-extension shapescript.shapescript --pre-release. Other editors can run shapescript-lsp, which this package puts on the environment's PATH.

See the repository for the tour, and the language reference. Licensed under MIT or Apache-2.0, at your option.

Metadata

Release files for shapescript 0.1.4b1

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

Source distribution (sdist)

Source distribution for shapescript 0.1.4b1
File Size Uploaded Provenance Actions
shapescript-0.1.4b1.tar.gz 743.2 kB With provenance Details for shapescript-0.1.4b1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for shapescript 0.1.4b1
File Actions
shapescript-0.1.4b1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for shapescript-0.1.4b1-cp39-abi3-win_amd64.whl
shapescript-0.1.4b1-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for shapescript-0.1.4b1-cp39-abi3-manylinux_2_28_x86_64.whl
shapescript-0.1.4b1-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for shapescript-0.1.4b1-cp39-abi3-manylinux_2_28_aarch64.whl
shapescript-0.1.4b1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for shapescript-0.1.4b1-cp39-abi3-macosx_11_0_arm64.whl
shapescript-0.1.4b1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for shapescript-0.1.4b1-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 41.8 MB

Release files / shapescript-0.1.4b1.tar.gz

Download URL shapescript-0.1.4b1.tar.gz
Size 743.2 kB
Tags Source
SHA-256 checksum
How to use checksums
15f7bc80dae8d93b7be407eb7e72f76dab47a391185b1b33c176efcdcf93e38b
BLAKE2b-256 checksum
How to use checksums
c51be272a5f7f0445cfd20c3a34aec865afef9fe93d354768d3a423593bc853e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 3, 2026.

Transparency log

Release files / shapescript-0.1.4b1-cp39-abi3-win_amd64.whl

Download URL shapescript-0.1.4b1-cp39-abi3-win_amd64.whl
Size 8.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5d03cdf1446326e1fc9023bee7d4e44aa6c725d3a020e9b23aa95230fba2bf8d
BLAKE2b-256 checksum
How to use checksums
2c0b56d636e85d312d4e1270976a7a7e13f6353c1ced7a31267f908fe953afa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 3, 2026.

Transparency log

Release files / shapescript-0.1.4b1-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL shapescript-0.1.4b1-cp39-abi3-manylinux_2_28_x86_64.whl
Size 8.9 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
1eef9cd905e7b070ed862954dd920367795eb5b637efa3b5c7d9f5b3f3d7193b
BLAKE2b-256 checksum
How to use checksums
e7faac4e48c09883fcbc8220e132df7c5ad69fec950cbb19d26f914ab4d6f101
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 3, 2026.

Transparency log

Release files / shapescript-0.1.4b1-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL shapescript-0.1.4b1-cp39-abi3-manylinux_2_28_aarch64.whl
Size 7.5 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
8fcd3c587992d2b04ae0737fb5efed9c78c98255217f8400b0b0d1c0de2ad989
BLAKE2b-256 checksum
How to use checksums
b425c3659a5be3535101d725ab2fc995372386f6818093b210ab0f23a98f8ac7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 3, 2026.

Transparency log

Release files / shapescript-0.1.4b1-cp39-abi3-macosx_11_0_arm64.whl

Download URL shapescript-0.1.4b1-cp39-abi3-macosx_11_0_arm64.whl
Size 8.1 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6a336b2da4663a19efce10a75346ca7aa6f50a9b41b54120f1df4f82ee047ba8
BLAKE2b-256 checksum
How to use checksums
405c1ca4133d61f7cb313dd487ab6bfadbbf978023a4acc4315050ee6723a932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 3, 2026.

Transparency log

Release files / shapescript-0.1.4b1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL shapescript-0.1.4b1-cp39-abi3-macosx_10_12_x86_64.whl
Size 8.4 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6f65f495aecb858c91d71b2d2a4b159b0208703d0bc371a98934c92cf26d1653
BLAKE2b-256 checksum
How to use checksums
8237e62fc4eb9386143bd1baabd4e571f81b6d48b8e33d46e642a4ed29606d8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 3, 2026.

Transparency log

Security for shapescript 0.1.4b1

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for shapescript-0.1.4b1.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 3, 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