tet-py
Python bindings for Tetration — mmap-friendly .tet tensor files and the JSON/TOML query engine.
| Install (PyPI) | pip install tet-py |
| Import | import tet |
| Rust core | tetration on crates.io |
| CLI (no Python) | tet binary from the main repo |
Status (0.1.2): read/query (incl. preview=N, TOML queries, memory_budget_* kwargs); NumPy ram / spill / sidecar (incl. f16/u32/u64 export + read_numpy budget preflight); TetWriter / write_dataset (layout-v1 floats + integers); tet.convert for .npy/.npz (other formats stubbed via extras). Pins tetration 0.1.12. See CHANGELOG.md and docs/HANDOFF.md.
Do not pip install tetration — that PyPI name is an unrelated math package. Use tet-py / import tet.
Quick start
Prerequisites
- Python 3.11+
- Rust 1.95+ (
.mise.tomlpinsrust = "1.95", or install matching rustup toolchain;native/Cargo.tomlsetsrust-version = "1.95") - maturin (
pip install maturinoruv tool install maturin)
Development
cd ~/Code/tet-py
uv sync --extra dev
mise run develop # or: uv run maturin develop
uv run python -c "import tet; print(tet.__version__, tet.core_version())"
uv run pytest -q
uv run mypy python/tet
Links tetration 0.1.12 from crates.io. Test fixtures live in tests/fixtures/.
Example
import tet
with tet.open("tests/fixtures/large.tet") as f: # or any .tet path
print(f.mean("a"), f.quantile("a", 0.5))
r = f.mean("a", preview=32) # QueryResult: r.scalar + r.preview (ndarray)
arr = f.read_numpy("a") # ram
z = f.transform.to_numpy.zscore("a") # transform → ram
spill = f.transform.to_spill.zscore("a", path="a_zscore.bin")
same = spill.to_numpy() # transform → spill → ndarray
side = f.transform.to_sidecar.zscore("a", path="a_zscore.tet")
same = side.to_numpy(f) # transform → sidecar .tet → ndarray
Operations reference (every op with examples): docs/operations.md
| Topic | Where |
|---|---|
mean, min, quantile, histogram, … |
docs/operations.md |
| NumPy ram / spill / sidecar | docs/operations.md#read_numpy |
build_query, selection_slices |
docs/operations.md#selection-and-build_query |
| Wire schema / CLI | tetration query engine |
| All docs | docs/README.md |
info() / summary()
Both return the full tet info --json dict (superblock, datasets, all chunk rows, metadata). For exploration, prefer list(f), f.dataset(name), or info["datasets"] — not printing the whole dict in the REPL.
Project layout
tet-py/
pyproject.toml # PEP 621 + maturin
python/tet/ # public API + _core, _query, _io, _transform
native/ # PyO3 extension (links tetration 0.1.12)
tests/fixtures/ # vendored .tet fixtures for CI
docs/ # operations.md, HANDOFF.md
CHANGELOG.md
Roadmap
- Scaffold: maturin,
tet.open,datasets,query(JSON document) -
query()/execute(raw=False)→QueryResult -
summary()/info()— dict parity withtet info --json - Reduction helpers (
mean,sum,min,max, …) -
quantile,histogram,covariance,correlation -
build_query,axis_slice,selection_slices -
Dataset,iter_datasets(),f[0]/f["name"], axis index ordim_names -
UnknownDatasetError/UnknownAxisError; optionaltyping_stub() - mypy +
_native.pyi - NumPy read — ram (
read_numpy,Dataset.to_numpy,transform.to_numpy) - NumPy read — spill (
read_spill,transform.to_spill,.to_numpy()loaders) - NumPy read — sidecar (
transform.to_sidecar,SidecarTransformResult.to_numpy) - NumPy write (
TetWriter,write_dataset) - PyPI wheels (
tet-py0.2.0); tetration pin 0.2.0 on crates.io - Query preview samples (
preview=N,QueryResult.preview) — #7 - CI fixtures vendored in
tests/fixtures/(no sibling tetration checkout) — #6 - Zero-copy
read_numpyfor contiguous raw payloads (THI-21)
To do
Near-term
- Pre-bump stack (THI-452) — CI mypy, budgets, TOML, tests, convert npy scaffold
- Pin tetration 0.1.12 (THI-457) —
read_numpypreflight (THI-23), f16/u32/u64 export (THI-15),f64_row_majorwriter - Integer / f16
write_datasetdtypes (THI-26) - Pin tetration 0.2.0 + zero-copy NumPy (THI-21)
-
tet.convertfull extras (THI-22) — h5/netcdf/zarr/csv/parquet implementations (stubs + extras exist; Rust CLI remains fast path)
Docs
- Keep docs.tetration.sh/python in sync with releases
Related
- CHANGELOG.md — release notes
- docs.tetration.sh — Python — install, NumPy sinks, operations
- docs/operations.md — query ops (
mean,quantile, …) with examples - docs/README.md — doc index
- HANDOFF.md — phases, dev commands, agent notes
- Layout v1
- Query engine
- AGENTS.md — ops and phase status
License
Dual-licensed under MIT OR Apache-2.0, same as tetration.
Metadata
Release files for tet-py 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tet_py-0.2.0.tar.gz | 48.4 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tet_py-0.2.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details |
| tet_py-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| tet_py-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| tet_py-0.2.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64, macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64) | Details |
Total release size: 6.6 MB
Release files / tet_py-0.2.0.tar.gz
| Download URL | tet_py-0.2.0.tar.gz |
|---|---|
| Size | 48.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0a7bf5ac8b14192a02cad1003a271eafcd70b04d0aa0479fedd67d61dd07de9
|
|
BLAKE2b-256 checksum How to use checksums |
d1207da1428710c0d663e8e9141374924afe5ee042b707e038f9efa9bb34b4f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / tet_py-0.2.0-cp311-abi3-win_amd64.whl
| Download URL | tet_py-0.2.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5be397cad18b5cb905622e1f44fbb78abbf067ab33678daf0b42ae1e4fbf1ea3
|
|
BLAKE2b-256 checksum How to use checksums |
801c16110dca139fa7917194ad41a88b94af046eec6a78ea51e2345e60199e08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / tet_py-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tet_py-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9d9c0004fbe1c5a5316a0cc8680769bbecb3eae26ee4311fc8c63c1226f9cbef
|
|
BLAKE2b-256 checksum How to use checksums |
bd73b5276f80646e4adde0ff12ef1513e71f3fcd22de39270534272ac19a6286
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / tet_py-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | tet_py-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0243726dfa519b85594e67fd9358fc679ae1e2c0237436f340419e9ff0a038b0
|
|
BLAKE2b-256 checksum How to use checksums |
6834059140837686a8e7f46bda0f54bd303a022dffb5dfc8d3239a2ee7126797
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / tet_py-0.2.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | tet_py-0.2.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9e47802253e40d7d20e62a1dc2aedad5f7d590f9ca2b164274c36f07bb611c1d
|
|
BLAKE2b-256 checksum How to use checksums |
673a87c570fc14892a4ed9c178e1a28d049b59ea4d1d6d6d17bafca545836f30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|