tet-py 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tet_py-0.1.0/PKG-INFO +140 -0
- tet_py-0.1.0/README.md +108 -0
- tet_py-0.1.0/native/Cargo.lock +1074 -0
- tet_py-0.1.0/native/Cargo.toml +18 -0
- tet_py-0.1.0/native/build.rs +37 -0
- tet_py-0.1.0/native/src/lib.rs +233 -0
- tet_py-0.1.0/native/src/numpy_export.rs +31 -0
- tet_py-0.1.0/native/src/numpy_write.rs +64 -0
- tet_py-0.1.0/native/src/writer.rs +206 -0
- tet_py-0.1.0/pyproject.toml +51 -0
- tet_py-0.1.0/python/tet/__init__.py +112 -0
- tet_py-0.1.0/python/tet/_core/__init__.py +16 -0
- tet_py-0.1.0/python/tet/_core/docstrings.py +100 -0
- tet_py-0.1.0/python/tet/_core/dtype.py +67 -0
- tet_py-0.1.0/python/tet/_core/errors.py +162 -0
- tet_py-0.1.0/python/tet/_io/__init__.py +16 -0
- tet_py-0.1.0/python/tet/_io/numpy.py +82 -0
- tet_py-0.1.0/python/tet/_io/spill.py +244 -0
- tet_py-0.1.0/python/tet/_io/writer.py +125 -0
- tet_py-0.1.0/python/tet/_native.pyi +47 -0
- tet_py-0.1.0/python/tet/_query/__init__.py +25 -0
- tet_py-0.1.0/python/tet/_query/doc.py +274 -0
- tet_py-0.1.0/python/tet/_query/result.py +247 -0
- tet_py-0.1.0/python/tet/_transform/__init__.py +21 -0
- tet_py-0.1.0/python/tet/_transform/ops.py +334 -0
- tet_py-0.1.0/python/tet/_transform/result.py +386 -0
- tet_py-0.1.0/python/tet/catalog.py +163 -0
- tet_py-0.1.0/python/tet/file.py +1062 -0
- tet_py-0.1.0/python/tet/py.typed +0 -0
tet_py-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tet-py
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: Intended Audience :: Science/Research
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Rust
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering
|
|
14
|
+
Requires-Dist: numpy>=2.0
|
|
15
|
+
Requires-Dist: pytest>=8.0 ; extra == 'dev'
|
|
16
|
+
Requires-Dist: maturin>=1.7 ; extra == 'dev'
|
|
17
|
+
Requires-Dist: mypy>=1.13 ; extra == 'dev'
|
|
18
|
+
Requires-Dist: numpy>=2.0 ; extra == 'dev'
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
License-File: LICENSE-APACHE
|
|
21
|
+
License-File: LICENSE-MIT
|
|
22
|
+
Summary: Python bindings for Tetration .tet files and the query engine
|
|
23
|
+
Keywords: tetration,tensor,mmap,zarr,hdf5,netcdf
|
|
24
|
+
Author-email: AHurowitz <latkaindustries@gmail.com>
|
|
25
|
+
License: MIT OR Apache-2.0
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
28
|
+
Project-URL: Documentation, https://github.com/Latka-Industries/tetration/blob/main/docs/query_engine.md
|
|
29
|
+
Project-URL: Homepage, https://github.com/Latka-Industries/tet-py
|
|
30
|
+
Project-URL: Repository, https://github.com/Latka-Industries/tet-py
|
|
31
|
+
|
|
32
|
+
# tet-py
|
|
33
|
+
|
|
34
|
+
[](https://docs.astral.sh/uv/)
|
|
35
|
+
[](https://github.com/Latka-Industries/tet-py/actions/workflows/ci.yml)
|
|
36
|
+
[](https://www.python.org/downloads/)
|
|
37
|
+
[](LICENSE-MIT)
|
|
38
|
+
|
|
39
|
+
Python bindings for [**Tetration**](https://github.com/Latka-Industries/tetration) — mmap-friendly `.tet` tensor files and the JSON/TOML query engine.
|
|
40
|
+
|
|
41
|
+
| Install (PyPI) | `pip install tet-py` _(when published)_ |
|
|
42
|
+
| Import | `import tet` |
|
|
43
|
+
| Rust core | [`tetration`](https://crates.io/crates/tetration) on crates.io |
|
|
44
|
+
| CLI (no Python) | [`tet`](https://github.com/Latka-Industries/tetration) binary from the main repo |
|
|
45
|
+
|
|
46
|
+
**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](docs/HANDOFF.md#github-tracking-tet-py).
|
|
47
|
+
|
|
48
|
+
Do not `pip install tetration` — that PyPI name is an unrelated math package. Use **`tet-py`** / **`import tet`**.
|
|
49
|
+
|
|
50
|
+
## Quick start
|
|
51
|
+
|
|
52
|
+
### Prerequisites
|
|
53
|
+
|
|
54
|
+
- Python **3.11+**
|
|
55
|
+
- Rust **1.95+** ([`.mise.toml`](.mise.toml) pins `rust = "1.95"`, or install matching [rustup](https://rustup.rs/) toolchain; `native/Cargo.toml` sets `rust-version = "1.95"`)
|
|
56
|
+
- [maturin](https://www.maturin.rs/) (`pip install maturin` or `uv tool install maturin`)
|
|
57
|
+
|
|
58
|
+
### Development
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cd ~/Code/tet-py
|
|
62
|
+
uv sync --extra dev
|
|
63
|
+
mise run develop # or: uv run maturin develop
|
|
64
|
+
uv run python -c "import tet; print(tet.__version__, tet.core_version())"
|
|
65
|
+
uv run pytest -q
|
|
66
|
+
uv run mypy python/tet
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Links **tetration 0.1.9** from crates.io. Test fixtures live in `tests/fixtures/`.
|
|
70
|
+
|
|
71
|
+
### Example
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
import tet
|
|
75
|
+
|
|
76
|
+
with tet.open("../tetration/fixtures/small/tet/large.tet") as f:
|
|
77
|
+
print(f.mean("a"), f.quantile("a", 0.5))
|
|
78
|
+
arr = f.read_numpy("a") # ram
|
|
79
|
+
z = f.transform.to_numpy.zscore("a") # transform → ram
|
|
80
|
+
spill = f.transform.to_spill.zscore("a", path="a_zscore.bin")
|
|
81
|
+
same = spill.to_numpy() # transform → spill → ndarray
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Operations reference** (every op with examples): [**docs/operations.md**](docs/operations.md)
|
|
85
|
+
|
|
86
|
+
| Topic | Where |
|
|
87
|
+
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
88
|
+
| `mean`, `min`, `quantile`, `histogram`, … | [docs/operations.md](docs/operations.md) |
|
|
89
|
+
| NumPy ram / spill / sidecar | [docs/operations.md#read_numpy](docs/operations.md#read_numpy) |
|
|
90
|
+
| `build_query`, `selection_slices` | [docs/operations.md#selection-and-build_query](docs/operations.md#selection-and-build_query) |
|
|
91
|
+
| Wire schema / CLI | [tetration query engine](https://github.com/Latka-Industries/tetration/blob/main/docs/query_engine.md) |
|
|
92
|
+
| All docs | [docs/README.md](docs/README.md) |
|
|
93
|
+
|
|
94
|
+
### `info()` / `summary()`
|
|
95
|
+
|
|
96
|
+
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.
|
|
97
|
+
|
|
98
|
+
## Project layout
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
tet-py/
|
|
102
|
+
pyproject.toml # PEP 621 + maturin
|
|
103
|
+
python/tet/ # facade (_file, _numpy, _spill, _transform, _query, …)
|
|
104
|
+
native/ # PyO3 extension (links tetration)
|
|
105
|
+
src/lib.rs
|
|
106
|
+
tests/
|
|
107
|
+
docs/ # operations.md, HANDOFF.md
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Roadmap
|
|
111
|
+
|
|
112
|
+
- [x] Scaffold: maturin, `tet.open`, `datasets`, `query` (JSON document)
|
|
113
|
+
- [x] `query()` / `execute(raw=False)` → `QueryResult`
|
|
114
|
+
- [x] `summary()` / `info()` — dict parity with `tet info --json`
|
|
115
|
+
- [x] Reduction helpers (`mean`, `sum`, `min`, `max`, …)
|
|
116
|
+
- [x] `quantile`, `histogram`, `covariance`, `correlation`
|
|
117
|
+
- [x] `build_query`, `axis_slice`, `selection_slices`
|
|
118
|
+
- [x] `Dataset`, `iter_datasets()`, `f[0]` / `f["name"]`, axis index or `dim_names`
|
|
119
|
+
- [x] `UnknownDatasetError` / `UnknownAxisError`; optional `typing_stub()`
|
|
120
|
+
- [x] mypy + `_native.pyi`
|
|
121
|
+
- [x] NumPy read — ram (`read_numpy`, `Dataset.to_numpy`, `transform.to_numpy`)
|
|
122
|
+
- [x] NumPy read — spill (`read_spill`, `transform.to_spill`, `.to_numpy()` loaders)
|
|
123
|
+
- [x] NumPy read — sidecar (`transform.to_sidecar`, `SidecarTransformResult.to_numpy`)
|
|
124
|
+
- [x] NumPy write (`TetWriter`, `write_dataset`)
|
|
125
|
+
- [ ] Optional convert extras: `h5py`, `netCDF4`, `zarr`, `pandas`, `pyarrow` — [#10](https://github.com/Latka-Industries/tet-py/issues/10)
|
|
126
|
+
- [ ] Wheels on PyPI; pin `tetration = "x.y.z"` from crates.io for release builds — [#5](https://github.com/Latka-Industries/tet-py/issues/5)
|
|
127
|
+
|
|
128
|
+
## Related
|
|
129
|
+
|
|
130
|
+
- [docs/operations.md](docs/operations.md) — query ops (`mean`, `quantile`, …) with examples
|
|
131
|
+
- [docs/README.md](docs/README.md) — doc index
|
|
132
|
+
- [HANDOFF.md](docs/HANDOFF.md) — phases, dev commands, agent notes
|
|
133
|
+
- [Layout v1](https://github.com/Latka-Industries/tetration/blob/main/docs/layout_v1.md)
|
|
134
|
+
- [Query engine](https://github.com/Latka-Industries/tetration/blob/main/docs/query_engine.md)
|
|
135
|
+
- [AGENTS.md](https://github.com/Latka-Industries/tetration/blob/main/AGENTS.md) — ops and phase status
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
Dual-licensed under **MIT OR Apache-2.0**, same as [tetration](https://github.com/Latka-Industries/tetration).
|
|
140
|
+
|
tet_py-0.1.0/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# tet-py
|
|
2
|
+
|
|
3
|
+
[](https://docs.astral.sh/uv/)
|
|
4
|
+
[](https://github.com/Latka-Industries/tet-py/actions/workflows/ci.yml)
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](LICENSE-MIT)
|
|
7
|
+
|
|
8
|
+
Python bindings for [**Tetration**](https://github.com/Latka-Industries/tetration) — mmap-friendly `.tet` tensor files and the JSON/TOML query engine.
|
|
9
|
+
|
|
10
|
+
| Install (PyPI) | `pip install tet-py` _(when published)_ |
|
|
11
|
+
| Import | `import tet` |
|
|
12
|
+
| Rust core | [`tetration`](https://crates.io/crates/tetration) on crates.io |
|
|
13
|
+
| CLI (no Python) | [`tet`](https://github.com/Latka-Industries/tetration) binary from the main repo |
|
|
14
|
+
|
|
15
|
+
**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](docs/HANDOFF.md#github-tracking-tet-py).
|
|
16
|
+
|
|
17
|
+
Do not `pip install tetration` — that PyPI name is an unrelated math package. Use **`tet-py`** / **`import tet`**.
|
|
18
|
+
|
|
19
|
+
## Quick start
|
|
20
|
+
|
|
21
|
+
### Prerequisites
|
|
22
|
+
|
|
23
|
+
- Python **3.11+**
|
|
24
|
+
- Rust **1.95+** ([`.mise.toml`](.mise.toml) pins `rust = "1.95"`, or install matching [rustup](https://rustup.rs/) toolchain; `native/Cargo.toml` sets `rust-version = "1.95"`)
|
|
25
|
+
- [maturin](https://www.maturin.rs/) (`pip install maturin` or `uv tool install maturin`)
|
|
26
|
+
|
|
27
|
+
### Development
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cd ~/Code/tet-py
|
|
31
|
+
uv sync --extra dev
|
|
32
|
+
mise run develop # or: uv run maturin develop
|
|
33
|
+
uv run python -c "import tet; print(tet.__version__, tet.core_version())"
|
|
34
|
+
uv run pytest -q
|
|
35
|
+
uv run mypy python/tet
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Links **tetration 0.1.9** from crates.io. Test fixtures live in `tests/fixtures/`.
|
|
39
|
+
|
|
40
|
+
### Example
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import tet
|
|
44
|
+
|
|
45
|
+
with tet.open("../tetration/fixtures/small/tet/large.tet") as f:
|
|
46
|
+
print(f.mean("a"), f.quantile("a", 0.5))
|
|
47
|
+
arr = f.read_numpy("a") # ram
|
|
48
|
+
z = f.transform.to_numpy.zscore("a") # transform → ram
|
|
49
|
+
spill = f.transform.to_spill.zscore("a", path="a_zscore.bin")
|
|
50
|
+
same = spill.to_numpy() # transform → spill → ndarray
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Operations reference** (every op with examples): [**docs/operations.md**](docs/operations.md)
|
|
54
|
+
|
|
55
|
+
| Topic | Where |
|
|
56
|
+
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
57
|
+
| `mean`, `min`, `quantile`, `histogram`, … | [docs/operations.md](docs/operations.md) |
|
|
58
|
+
| NumPy ram / spill / sidecar | [docs/operations.md#read_numpy](docs/operations.md#read_numpy) |
|
|
59
|
+
| `build_query`, `selection_slices` | [docs/operations.md#selection-and-build_query](docs/operations.md#selection-and-build_query) |
|
|
60
|
+
| Wire schema / CLI | [tetration query engine](https://github.com/Latka-Industries/tetration/blob/main/docs/query_engine.md) |
|
|
61
|
+
| All docs | [docs/README.md](docs/README.md) |
|
|
62
|
+
|
|
63
|
+
### `info()` / `summary()`
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
## Project layout
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
tet-py/
|
|
71
|
+
pyproject.toml # PEP 621 + maturin
|
|
72
|
+
python/tet/ # facade (_file, _numpy, _spill, _transform, _query, …)
|
|
73
|
+
native/ # PyO3 extension (links tetration)
|
|
74
|
+
src/lib.rs
|
|
75
|
+
tests/
|
|
76
|
+
docs/ # operations.md, HANDOFF.md
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Roadmap
|
|
80
|
+
|
|
81
|
+
- [x] Scaffold: maturin, `tet.open`, `datasets`, `query` (JSON document)
|
|
82
|
+
- [x] `query()` / `execute(raw=False)` → `QueryResult`
|
|
83
|
+
- [x] `summary()` / `info()` — dict parity with `tet info --json`
|
|
84
|
+
- [x] Reduction helpers (`mean`, `sum`, `min`, `max`, …)
|
|
85
|
+
- [x] `quantile`, `histogram`, `covariance`, `correlation`
|
|
86
|
+
- [x] `build_query`, `axis_slice`, `selection_slices`
|
|
87
|
+
- [x] `Dataset`, `iter_datasets()`, `f[0]` / `f["name"]`, axis index or `dim_names`
|
|
88
|
+
- [x] `UnknownDatasetError` / `UnknownAxisError`; optional `typing_stub()`
|
|
89
|
+
- [x] mypy + `_native.pyi`
|
|
90
|
+
- [x] NumPy read — ram (`read_numpy`, `Dataset.to_numpy`, `transform.to_numpy`)
|
|
91
|
+
- [x] NumPy read — spill (`read_spill`, `transform.to_spill`, `.to_numpy()` loaders)
|
|
92
|
+
- [x] NumPy read — sidecar (`transform.to_sidecar`, `SidecarTransformResult.to_numpy`)
|
|
93
|
+
- [x] NumPy write (`TetWriter`, `write_dataset`)
|
|
94
|
+
- [ ] Optional convert extras: `h5py`, `netCDF4`, `zarr`, `pandas`, `pyarrow` — [#10](https://github.com/Latka-Industries/tet-py/issues/10)
|
|
95
|
+
- [ ] Wheels on PyPI; pin `tetration = "x.y.z"` from crates.io for release builds — [#5](https://github.com/Latka-Industries/tet-py/issues/5)
|
|
96
|
+
|
|
97
|
+
## Related
|
|
98
|
+
|
|
99
|
+
- [docs/operations.md](docs/operations.md) — query ops (`mean`, `quantile`, …) with examples
|
|
100
|
+
- [docs/README.md](docs/README.md) — doc index
|
|
101
|
+
- [HANDOFF.md](docs/HANDOFF.md) — phases, dev commands, agent notes
|
|
102
|
+
- [Layout v1](https://github.com/Latka-Industries/tetration/blob/main/docs/layout_v1.md)
|
|
103
|
+
- [Query engine](https://github.com/Latka-Industries/tetration/blob/main/docs/query_engine.md)
|
|
104
|
+
- [AGENTS.md](https://github.com/Latka-Industries/tetration/blob/main/AGENTS.md) — ops and phase status
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
Dual-licensed under **MIT OR Apache-2.0**, same as [tetration](https://github.com/Latka-Industries/tetration).
|