Skip to main content

Typed data-kind vocabulary — a structural Kind protocol plus xarray/numpy kinds — shared across the latent-reasoning stack.

Project description

manykinds

The typed data-kind vocabulary for the latent-reasoning stack.

A kind is a self-describing data object that guards its own structure — it validates on construction and refuses an op that demands structure it lacks, instead of being a bare array whose axes you have to trust. manykinds is the small, shared package that defines that vocabulary so independent tools can interoperate through it without depending on each other.

It's the same pattern as anndata in single-cell or the Array API standard for array libraries: one light package everyone agrees on, rather than each tool inventing (or embedding) its own data contract.

What's in it

  • Kind — a @runtime_checkable structural protocol (provenance, require, tagged). Orchestrators type their ops against it; a concrete kind is substitutable iff it offers the three members — no inheritance required. Lives in manykinds.base and imports without the array stack.
  • LabeledArray — an xarray.DataArray with named dims + dim-aligned coords. The canonical kind for cell×gene matrices and embeddings. Dense and sparse.COO-backed arrays both serialize to zarr (validating on read).
  • SparseGraph — a graph as two numpy arrays (an E×2 integer edge list + node ids). .npz persistence.

Usage

import xarray as xr, numpy as np
from manykinds import Kind, LabeledArray

la = LabeledArray(
    xr.DataArray(
        np.random.randn(100, 2000),
        dims=("cell", "gene"),
        coords={"time": ("cell", np.zeros(100, dtype=int))},
    )
)

isinstance(la, Kind)                       # True — structural, no inheritance
la.require("cell", "gene", coords=("time",))   # precondition gate; raises if absent
la = la.tagged("pca")                      # append to the immutable provenance trail
la.serialize("embedding.zarr")             # dense or sparse; validates on load

Who depends on it

  • Producers (dataset adapters like manylatents-omics, model wrappers, tool shims) construct kinds from their own formats.
  • Orchestrators (e.g. an op registry / planner) type their ops against Kind and chain a producer's output into a consumer's require.

The vocabulary is deliberately small and stable — it changes far more slowly than the tools that speak it.

License

MIT

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

manykinds-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

manykinds-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file manykinds-0.1.0.tar.gz.

File metadata

  • Download URL: manykinds-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for manykinds-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6e72b26a81b8c970f8a012b6a07683f0432c03b30ecd63c5af87e64699125dce
MD5 d7f332ab9de83e1524fa6aa7b5163ddd
BLAKE2b-256 8dde7c0bce7349000918b5842645c29afa79d8ddc119913a121fd8e7958c340f

See more details on using hashes here.

File details

Details for the file manykinds-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: manykinds-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for manykinds-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 627c6a57d341b3656eceb671d481519e7938c251e5a7a240f2e37ca16c539e2b
MD5 1f18a68534d183d031ab47d828bff0e1
BLAKE2b-256 d1e0c6df54ac5f782aafe2176dab4d4e6f14a8e24caad1447eb6a596ee84ad5b

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