Skip to main content

Python bindings for Tetration .tet files and the query engine

Project description

tet-py

PyPI uv CI Python License

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.1): read/query API (including preview=N on reductions); NumPy ram / spill / sidecar; TetWriter / write_dataset (f32/f64). Next: tet.convert extras, read_numpy preflight, integer write dtypes — 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.toml pins rust = "1.95", or install matching rustup toolchain; native/Cargo.toml sets rust-version = "1.95")
  • maturin (pip install maturin or uv 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("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.9)
  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 with tet 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 or dim_names
  • UnknownDatasetError / UnknownAxisError; optional typing_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-py 0.1.0+); tetration = "0.1.9" from crates.io
  • Query preview samples (preview=N, QueryResult.preview) — #7
  • Optional convert extras: h5py, netCDF4, zarr, pandas, pyarrow#10

Related

License

Dual-licensed under MIT OR Apache-2.0, same as tetration.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tet_py-0.1.1.tar.gz (42.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tet_py-0.1.1-cp311-abi3-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.11+Windows x86-64

tet_py-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

tet_py-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

tet_py-0.1.1-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.4 MB view details)

Uploaded CPython 3.11+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file tet_py-0.1.1.tar.gz.

File metadata

  • Download URL: tet_py-0.1.1.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for tet_py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 902ca32bf5ad02475fdb1677d4aa93d5c896f06d04d73efd4fe752ca6b99702e
MD5 ae61e6eabf2257f19bef30f2131326be
BLAKE2b-256 83e51f5e8841264d6f594b452e4440995ca6f7274069b7bc4d8f5b410c9c1bfd

See more details on using hashes here.

File details

Details for the file tet_py-0.1.1-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: tet_py-0.1.1-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for tet_py-0.1.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 380d73cb5ac6f3e5dcff21799f32a4a772d63135902d72aae2b70e5e015f0895
MD5 e637d819fcc8d6286eb3852c019dc973
BLAKE2b-256 894b418442a1b6202ad599af77e9a086045cf846272352d2b60477eb531df1ef

See more details on using hashes here.

File details

Details for the file tet_py-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tet_py-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 020a1f2bfebceb8f3d2123331b86ff6618f0520177306652163030ae7cdf1726
MD5 aa97ab2addc8d71f53b506c07b2a318f
BLAKE2b-256 6cb8956058440f9a7c6bb8271086314e70abafe6ab03214c5644c01b40ea1aee

See more details on using hashes here.

File details

Details for the file tet_py-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tet_py-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e78c1b769c464f30f8abc3109e1dce38692eaeb083f765363030de8129f1747
MD5 0376a5d2cd9bf45e57b416c056d6ba23
BLAKE2b-256 4892a6ee2f73782e03913e64e8283578249bdb30cf4dabbb760a8becb6ff5886

See more details on using hashes here.

File details

Details for the file tet_py-0.1.1-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for tet_py-0.1.1-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b2836b793de0cf321c442f475ed7aee8088a03af07378602fb96026e037c748e
MD5 a49bbd6426616cbd2748304018608992
BLAKE2b-256 41d8c144148b332f30c4157eb65451b79d7a10bf3b22f174ae0b4f80de687d16

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page