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.2b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shapescript-0.1.2b1.tar.gz | 738.1 kB | Without provenance | Details for shapescript-0.1.2b1.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| shapescript-0.1.2b1-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details for shapescript-0.1.2b1-cp39-abi3-win_amd64.whl |
| shapescript-0.1.2b1-cp39-abi3-manylinux_2_28_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ x86-64 | Details for shapescript-0.1.2b1-cp39-abi3-manylinux_2_28_x86_64.whl |
| shapescript-0.1.2b1-cp39-abi3-manylinux_2_28_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ ARM64 | Details for shapescript-0.1.2b1-cp39-abi3-manylinux_2_28_aarch64.whl |
| shapescript-0.1.2b1-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details for shapescript-0.1.2b1-cp39-abi3-macosx_11_0_arm64.whl |
| shapescript-0.1.2b1-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details for shapescript-0.1.2b1-cp39-abi3-macosx_10_12_x86_64.whl |
Total release size: 42.3 MB
Release files / shapescript-0.1.2b1.tar.gz
| Download URL | shapescript-0.1.2b1.tar.gz |
|---|---|
| Size | 738.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df9d74eb7724243d5b0bac08a77c2e331e8486b8aba0f2ec40ae2ded47fa5017
|
|
BLAKE2b-256 checksum How to use checksums |
92d9f82950b6cdcc88d1a82faf63e5e7a98b68d932a808ac3697a0acd78f2d7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / shapescript-0.1.2b1-cp39-abi3-win_amd64.whl
| Download URL | shapescript-0.1.2b1-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
82c7fe123567eed03d1c8d8a9195dbe1e194060d3da7bb65f5a4dce0e5b7c9c2
|
|
BLAKE2b-256 checksum How to use checksums |
719bf020ca45e3e8b9c08fa645d962660b351691027ef6291a051d75bca147bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / shapescript-0.1.2b1-cp39-abi3-manylinux_2_28_x86_64.whl
| Download URL | shapescript-0.1.2b1-cp39-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ff8c2cc081c004a4ee1aa00ca04dfc1035cd94a5b0c40c61d7c5a3b0096da2aa
|
|
BLAKE2b-256 checksum How to use checksums |
bde5c2b4611fde2bd66867e4c53d7ece7c5cf27af5c136ea65240559016ab931
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / shapescript-0.1.2b1-cp39-abi3-manylinux_2_28_aarch64.whl
| Download URL | shapescript-0.1.2b1-cp39-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 8.5 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
f5676e347e10ddb3e4443cc2f19cc7f1d551c9a0d1f3055dabaa1a6839804a73
|
|
BLAKE2b-256 checksum How to use checksums |
7e22356cb25ab3cb6209de43d4afe8c79b5164922b5b59bd2d69dab6388f083f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / shapescript-0.1.2b1-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | shapescript-0.1.2b1-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 8.2 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5ea192d4e6e1f997f387d9f391914c688fb8abd365b7e655cbe0f7a74a1d20d4
|
|
BLAKE2b-256 checksum How to use checksums |
4b80fc79aa20ff74ed13416698c7df4f166484dd79256b937f86a7d0c9a320c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / shapescript-0.1.2b1-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | shapescript-0.1.2b1-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 8.6 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
97ab1a5197a88393a30020c40d4011b4b3b46cfb44e1341c5e1232d101cd87ee
|
|
BLAKE2b-256 checksum How to use checksums |
ad0df409eb3abe4894c6cce4ccc52135417ec68bddf3b5cf00be365ad2a9ed87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Security for shapescript 0.1.2b1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.