racah-py
AI-generated, for agentic coding. This document was written by an AI agent as reference material for AI agents (and humans) working on this repository. It may contain errors — check it against the code and tests rather than trusting it blindly.
Python bindings (PyO3 + maturin) for the racah crate. racah
is the coefficient authority behind TeNeT-py's symmetry providers; this package
is how that consumer (and any other Python code) reaches it.
Two surfaces:
- SU(N), taking
Irreplabels and running the generated Gelfand–Tsetlin pipeline — irreps from Dynkin labels, fusion with outer multiplicities, dense m-basis Clebsch–Gordan tensors, F/R symbols with their multiplicity axes, and the verification gates. - exact SU(2), taking doubled integer spins and returning scalars from
closed-form big-rational arithmetic —
wigner_3j,wigner_6j,su2_clebsch_gordan,su2_f_symbol,su2_r_symbol,su2_frobenius_schur.
SU(2) is reachable through either (Irrep([2j]) is a rank-1 label), and they
are separate authorities with separate fingerprints. They agree on F and R and
differ on the Clebsch–Gordan coefficients by one sign per fusion channel —
see "Versioning and the gauge fingerprint" below.
Import name is racah; the distribution is racah-py. Wheels are always built
with the crate's cgc-gen feature on, so the generated coefficients are
available out of the box. CGC/F/R arrays come back as NumPy float64 arrays.
Installation
From PyPI (Python ≥ 3.12; prebuilt abi3 wheels for linux-x86_64 and macos-arm64):
pip install racah-py
Or from a checkout (needs a Rust stable toolchain):
git clone https://github.com/Ryo-wtnb11/racah
cd racah/racah-py
python -m venv .venv && . .venv/bin/activate
pip install maturin
maturin develop --release # builds the extension into the active venv
or build a wheel and install it anywhere:
maturin build --release --manifest-path racah-py/Cargo.toml --out dist
pip install --no-index --find-links dist racah-py
CI (wheels.yml) builds abi3-py312 wheels
for linux-x86_64 and macos-arm64; py-v* tags/releases publish them to PyPI.
One wheel per platform covers CPython ≥ 3.12.
Quick start
Verified against the built extension; every call below is the actual API
(see racah.pyi for the full typed surface).
import racah
three = racah.Irrep([1, 0]) # SU(3) fundamental, from its Dynkin label
assert three.dim() == 3 # exact integer, arbitrary precision
eight = racah.Irrep([1, 1]) # the adjoint
# Fusion: 3 x 3bar = 1 + 8, and the adjoint appears twice in 8 x 8.
assert racah.fusion(three, three.dual()) == [
(racah.Irrep([0, 0]), 1),
(eight, 1),
]
assert racah.fusion_multiplicity(eight, eight, eight) == 2 # N^8_88
# m-basis Clebsch-Gordan tensor: [dim(s1), dim(s2), dim(s3), N^{s3}_{s1 s2}].
cgc = racah.clebsch_gordan(three, three.dual(), eight)
assert cgc.shape == (3, 3, 8, 1)
# F-symbol block over the four multiplicity indices [mu, nu, kappa, lambda].
f = racah.f_symbol(eight, eight, eight, eight, eight, eight)
assert f.shape == (2, 2, 2, 2)
# R-symbol multiplicity matrix, N^c_ab x N^c_ba.
r = racah.r_symbol(three, three.dual(), eight)
assert r.shape == (1, 1)
# The verification gates raise RuntimeError on violation.
racah.check_pentagon(three, three.dual(), three, three.dual())
# The gauge fingerprint a consumer pins next to persisted coefficients.
print(racah.sun_authority_fingerprint())
The exact SU(2) surface takes doubled labels (dj = 2j, dm = 2m), so
every label stays an exact integer:
import racah
assert abs(racah.wigner_6j(2, 2, 2, 2, 2, 2) - 1 / 6) < 1e-14
assert racah.su2_r_symbol(1, 1, 0) == -1.0 # (-1)^(1/2 + 1/2 - 0)
assert racah.su2_r_symbol(1, 1, 4) == 0.0 # inadmissible is exact zero,
# not an error
print(racah.su2_authority_fingerprint())
Reaching the same R-symbol through r_symbol(Irrep([1]), Irrep([1]), Irrep([0]))
builds a Clebsch–Gordan tensor first; su2_r_symbol is a sign.
The rest of the surface: Irrep.from_weight / Irrep.trivial constructors,
the dynkin / weight / rank properties, and check_f_unitarity and
check_hexagon alongside check_pentagon.
Ill-posed input (bad label, mixed rank, empty fusion vertex) raises
ValueError; a tripped numerical gate (orthonormality, F-unitarity, pentagon,
hexagon, factorization failure) raises RuntimeError.
Versioning and the gauge fingerprint
F/R/CGC values depend on the CGC gauge; racah publishes them in one frozen
canonical gauge. racah.sun_authority_fingerprint() returns the opaque
authority string identifying that convention, generation pipeline, and
tolerance policy — TeNeT-py pins it next to persisted coefficients and refuses
a mismatch on load. Compare it by equality only; a breaking coefficient change
bumps the fingerprint epoch and is recorded in the
CHANGELOG. Same fingerprint means same convention and value
agreement within the oracle tolerance, not cross-process bit-identity
(docs.rs: sun_authority_fingerprint).
racah.su2_authority_fingerprint() is its twin for the exact SU(2) surface, and
the two are different strings on purpose. Numerical agreement is not authority
identity: F-symbols and R-symbols do agree between the tiers to round-off, but
their Clebsch–Gordan coefficients differ by exactly one sign per fusion
channel, uniform in the magnetic indices and equal to su2_r_symbol itself.
F and R are gauge-invariant combinations in which that phase cancels; CGC are
gauge data. Mixing the two tiers' CGC without the factor gives wrong signs and
no error, so record the fingerprint of whichever surface produced what you
persisted.
Documentation
The semantics are the crate's; the bindings add nothing:
- User Guide — task-oriented chapters; shapes and axis conventions match the arrays returned here.
docs/theory.pdf— the mathematics behind the objects.docs/gauge.md— the frozen SU(N) gauge specification the fingerprint names.- docs.rs/racah — exact per-item semantics and errors.
docs/README.md— the full documentation index.
Development
uv venv && uv pip install maturin pytest numpy
cd racah-py && maturin develop --release
pytest tests
Metadata
Release files for racah-py 0.1.2
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 |
|---|---|---|---|---|
| racah_py-0.1.2.tar.gz | 3.8 MB | With provenance | Details for racah_py-0.1.2.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| racah_py-0.1.2-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for racah_py-0.1.2-cp312-abi3-win_amd64.whl |
| racah_py-0.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ x86-64 | Details for racah_py-0.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| racah_py-0.1.2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ ARM64 | Details for racah_py-0.1.2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
| racah_py-0.1.2-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for racah_py-0.1.2-cp312-abi3-macosx_11_0_arm64.whl |
| racah_py-0.1.2-cp312-abi3-macosx_10_12_x86_64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64 | Details for racah_py-0.1.2-cp312-abi3-macosx_10_12_x86_64.whl |
Total release size: 71.5 MB
Release files / racah_py-0.1.2.tar.gz
| Download URL | racah_py-0.1.2.tar.gz |
|---|---|
| Size | 3.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2d85bfde8379d3684f42939316dfd5e01622a1ea4176d30e68b595e54664ab6
|
|
BLAKE2b-256 checksum How to use checksums |
08cf700b8c7c7dd7a13657b810e7cc547909edad882ea868ecedd6f496573804
|
| 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 Aug 25, 2026.
Transparency logRelease files / racah_py-0.1.2-cp312-abi3-win_amd64.whl
| Download URL | racah_py-0.1.2-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 15.0 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
10817576b517b9dba3864a7ad9b4054a98252d18e313edc1a1bbe81e8c5ec7a2
|
|
BLAKE2b-256 checksum How to use checksums |
96020e0889a715c7cdf471a4c994accfe91ca277964ba92ac70edf6491b4caaf
|
| 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 Aug 25, 2026.
Transparency logRelease files / racah_py-0.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | racah_py-0.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d925b85d83a72aec0d7b84c024ae13dd35598b2edc29fce21df48ee19fd1c83a
|
|
BLAKE2b-256 checksum How to use checksums |
4a596ccd7fec24f373be2a9c8a3eaef06830ae085b856c708c028fdc7fa867c5
|
| 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 Aug 25, 2026.
Transparency logRelease files / racah_py-0.1.2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | racah_py-0.1.2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 12.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
411afcc72dcfafd4b52a7e4236d9acadb6fdedbc1f9937c3fa17a28d63cb9bb6
|
|
BLAKE2b-256 checksum How to use checksums |
e559aa557034854637d57a351b626c82405b277db54f533d6d5efec77c42f072
|
| 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 Aug 25, 2026.
Transparency logRelease files / racah_py-0.1.2-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | racah_py-0.1.2-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 12.7 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a0d7cbd4f78fdf4f2e8913ff83b1ac78aa398d00bb55f1c03b07846071cbccdf
|
|
BLAKE2b-256 checksum How to use checksums |
b77878ee34f90dec85056365f4ed12fa27da86c5c37af102361945575fe613d7
|
| 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 Aug 25, 2026.
Transparency logRelease files / racah_py-0.1.2-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | racah_py-0.1.2-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 14.6 MB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f844b4b23314dd7450b83c51ba9a8538f585cb19b91193cfb39d0dc4e09cec35
|
|
BLAKE2b-256 checksum How to use checksums |
04b03a8ba2786dd82d16c8dbc32593d134ba1f15e9ed0c577fad4f64448d5994
|
| 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 Aug 25, 2026.
Transparency logSecurity for racah-py 0.1.2
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.
Attestation for racah_py-0.1.2.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 Aug 25, 2026.
Transparency logA 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.