Skip to main content

linaldb (Python native bindings)

Embedded native Python bindings for LINALDB — a PyO3 extension linking the same synchronous engine the CLI/REPL runs (TensorDb/execute_line, src/engine/db.rs + src/dsl/mod.rs) directly into your Python process. No server, no network — this is the "use it like SQLite" story, as opposed to clients/python (a thin HTTP client for a running linal serve). Not yet published to PyPI; see ../EMBEDDED_CONTRACT.md for the exact result shapes this module implements.

Usage

import linaldb

db = linaldb.Db()  # persists to ./data by default, exactly like the CLI
db.execute("CREATE DATASET t COLUMNS (id: Int, score: Float)")
db.execute("INSERT INTO t VALUES (1, 0.9), (2, 0.4)")

result = db.execute("SELECT * FROM t WHERE score > 0.5")
print(result.columns, result.rows)   # ExecuteResult
df = result.to_pandas()              # requires the `pandas` extra

db.execute("SAVE DATASET t")
dataset = db.dataset("t")
df = dataset.to_pandas()             # reads data.parquet directly off disk

See examples/digit_classification_embedded.py and the Jupyter notebook examples/digit_classification_embedded.ipynb for a complete real-data walkthrough — the same real UCI handwritten-digits classification workflow clients/python/examples/digit_classification.py runs over HTTP, ported to embedded mode: no linal serve subprocess at all, just an in-process Db(), an in-process classification query, and an independent numpy recomputation from the dataset export, cross-checked against the SQL result.

Build

This crate vendors HDF5 and pulls in arrow/tokio/axum/zarrs as dependencies of the root linal crate (Cargo.toml here has a path dependency on ../..) — the first build compiles all of that, same as building the CLI itself; a .cargo/config.toml here points the build at the repo-root target/ dir to avoid a second full vendor build if you've already built the root crate.

Requires a Rust toolchain (cmake + a C toolchain for HDF5, per the root CLAUDE.md) and maturin:

python3 -m venv .venv && source .venv/bin/activate
pip install maturin
maturin develop           # builds the extension, installs it into .venv

If your Python interpreter is newer than PyO3's currently-supported maximum CPython version, set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 for the build (PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 maturin develop) — this repo was built and verified against CPython 3.14 that way.

Development

source .venv/bin/activate
pip install -e ".[dev]"
maturin develop
pytest tests/

No live server needed for anything here (that's the whole point of embedded mode) — tests and examples all run against an in-process Db().

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

linaldb-0.1.4-cp39-abi3-win_amd64.whl (10.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

linaldb-0.1.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.6 MB view details)

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

linaldb-0.1.4-cp39-abi3-macosx_11_0_arm64.whl (8.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file linaldb-0.1.4-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: linaldb-0.1.4-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 10.1 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for linaldb-0.1.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 27af829fef6c9d990f57995c4a828c1795c11fe67b721a765df60c34dbe080c4
MD5 272a4d7f7bc30eb6a7b49790ca52eb11
BLAKE2b-256 ccf767f0a7ce6bc3afc3a630182bde6c09511a49060a1b14fbd3b759a633934c

See more details on using hashes here.

Provenance

The following attestation bundles were made for linaldb-0.1.4-cp39-abi3-win_amd64.whl:

Publisher: pypi-publish-embedded.yml on gorigami/linaldb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file linaldb-0.1.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for linaldb-0.1.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d6155f79dbc0f1ae46cf29d1afd98b81f846acafe8b2b8dc45c3da6b654a3ce
MD5 5b7cce9093732a40ba223e0bbbf232f7
BLAKE2b-256 7710a53739e6bba9a3fba620a200659ddf510c9af9bb107750d2e9fe548c5a7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for linaldb-0.1.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: pypi-publish-embedded.yml on gorigami/linaldb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file linaldb-0.1.4-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for linaldb-0.1.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 658329ae485469a78b59d81ed1ee7f2874602ee04de79f9884136dd3a75e3881
MD5 0c277dd7d302fc0f15c2778275b28aaa
BLAKE2b-256 cbed74943d8d1015d42a3585d1bcb54c0a838c2a8fca1c0403e310cbd083fff1

See more details on using hashes here.

Provenance

The following attestation bundles were made for linaldb-0.1.4-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: pypi-publish-embedded.yml on gorigami/linaldb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.12

3 files

0.1.11

3 files

0.1.10

3 files

0.1.9

3 files

0.1.8

3 files

0.1.7

3 files

0.1.6

3 files

0.1.5

3 files

This release

0.1.4 This release

3 files

0.1.3

3 files

0.1.2

3 files

0.1.1

3 files

0.1.0

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page