Python bindings for Tetration .tet files and the query engine
Project description
tet-py
Python bindings for Tetration — mmap-friendly .tet tensor files and the JSON/TOML query engine.
| Install (PyPI) | pip install tet-py (when published) |
| Import | import tet |
| Rust core | tetration on crates.io |
| CLI (no Python) | tet binary from the main repo |
Status: read/query API; NumPy interchange on all three tetration dense sinks (ram read_numpy / to_numpy, spill read_spill / to_spill, sidecar to_sidecar); write via TetWriter / write_dataset. Convert extras and PyPI wheels are next — see 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.9 from crates.io. Test fixtures live in tests/fixtures/.
Example
import tet
with tet.open("../tetration/fixtures/small/tet/large.tet") as f:
print(f.mean("a"), f.quantile("a", 0.5))
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
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/ # facade (_file, _numpy, _spill, _transform, _query, …)
native/ # PyO3 extension (links tetration)
src/lib.rs
tests/
docs/ # operations.md, HANDOFF.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) - Optional convert extras:
h5py,netCDF4,zarr,pandas,pyarrow— #10 - Wheels on PyPI; pin
tetration = "x.y.z"from crates.io for release builds — #5
Related
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tet_py-0.1.0.tar.gz.
File metadata
- Download URL: tet_py-0.1.0.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
648c3760953c0b703132eb6930ade5a8dc0a9f00d65099e140d04ba155f8330c
|
|
| MD5 |
2f0179c75fdc29b1c899d590df705fad
|
|
| BLAKE2b-256 |
dae40b686a33cd52c0a959e3845c3a5368ffff115d4f2aa8ae4af85b9dee9c46
|
File details
Details for the file tet_py-0.1.0-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: tet_py-0.1.0-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 998.8 kB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b382306d0a5e9970abd4c100f200686fa322ba8f1e4614bba7e2b5b562f322a7
|
|
| MD5 |
2c55ae5c2896e0d976f27e59810cc9a5
|
|
| BLAKE2b-256 |
4c0306fcd487c1f3d554406911b2f2809fed261a1cdbc444f1f97896c0fbc17a
|
File details
Details for the file tet_py-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tet_py-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cb678c983a4f1994d030aa8f87ea4aeaaf6a172062eee017293e2a50304a381
|
|
| MD5 |
afdf98fb8b61ea7c22778b641a897afe
|
|
| BLAKE2b-256 |
c153aac32f8c54966a22e78e7d15fd043bdd068870e726c6b4afa5c6825c45bb
|
File details
Details for the file tet_py-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: tet_py-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
638581cf5e31658b3447c326d38fab36c6d1e636bd953b9f67565542f92da918
|
|
| MD5 |
813bb191fabe7e1066bcadc89b8c933f
|
|
| BLAKE2b-256 |
a9ff1be66ea62a3e982c4e78b7cd2df7cd5de29528c2d5a6c8847ab2fcb20f88
|
File details
Details for the file tet_py-0.1.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: tet_py-0.1.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.11+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2ad8ebb7996abdaa56d2993609537886560caae73819e9c28bf6d4930ef5513
|
|
| MD5 |
969ff61fbfdb5bb394e9cb5c31002feb
|
|
| BLAKE2b-256 |
023c8d3d6dc0f3ac3b82b6ff6a10bfd600878cc2e31b0e16926e5800920594b7
|