SQLite for event-sourced state — Python bindings for salamander-db.
Project description
salamander-db (Python)
Native Python bindings for salamander-db — SQLite for event-sourced
state. This is a compiled extension (via PyO3 +
maturin), so it embeds the engine in your process
exactly like Python's built-in sqlite3 module wraps libsqlite3: you open
one handle and reuse it. No server, no subprocess.
The binding is a translation layer over the safe, non-generic Rust Engine.
Database ownership and cross-thread sequencing live in the core; Python does
not contain storage, replay, branching, or projection algorithms.
import salamander
db = salamander.open("./mem", commit_every_count=8) # one in-process handle
db.append("session-1", {"kind": "user_msg", "text": "hi"})
db.append("session-1", {"kind": "tool_call", "tool": "grep", "args": {"q": "500"}})
db.commit()
for ev in db.replay("session-1"):
print(ev["offset"], ev["body"]) # -> plain dicts, nested fields intact
The open handle owns the single-writer lock, any registered views, and the group-commit state — which is why it must be long-lived and in-process, not re-created per call.
Build it
Requires a Rust toolchain and Python ≥ 3.9.
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install maturin pytest
maturin develop -m salamander-py/Cargo.toml # compiles + installs into the venv
python examples/py/quickstart.py
python -m pytest examples/py/test_roundtrip.py -v
On a very new Python that the pinned PyO3 doesn't recognize yet, prefix the
build with PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 (the abi3 stable ABI is
forward-compatible).
API
| Python | Engine |
|---|---|
salamander.open(path, commit_every_bytes=, commit_every_count=, commit_every_millis=) |
JsonDb::open_with_policy |
db.append(namespace, event: dict) -> int |
append (payload = JSON) |
db.append_branch(branch, namespace, event) -> int |
append to an engine branch |
db.commit() -> int |
commit (fsync) |
db.head() -> int |
head |
db.uncommitted_count() -> int |
group-commit tally |
db.replay(namespace, start=0, end=None) -> list[dict] |
replay (literal) |
db.register_view(name, key, indexes={}, where_field=, where_value=) |
register an IndexedView |
db.view(name) -> View |
typed query handle |
db.deregister_view(name) -> bool |
deregister |
db.fork(namespace, at) -> str |
create branch (returns branch name) |
db.history(namespace) -> list[dict] |
default-branch replay |
db.branch_history(branch, namespace) -> list[dict] |
inherited branch replay |
View handles support .get(key), .by(index, key), .range(lo, hi),
.prefix(p), .len().
Payloads are any JSON-able Python value (dict/list/str/int/float/
bool/None), converted to/from serde_json::Value at the boundary. Views
are declared by field name (primary key, indexes mapping name→field, an
optional where_field/where_value filter) — no per-event Python callback
crosses the FFI boundary.
A LangGraph checkpointer that survives process restarts ships in
examples/py/; an MCP server is on the
roadmap. Branch lifecycle and ancestry use the same engine
catalog as Rust:
ancestry = db.branch_ancestry(branch_name) # root-first metadata dictionaries
archived = db.archive_branch(branch_name) # history remains readable
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
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 salamander_db-0.1.0.tar.gz.
File metadata
- Download URL: salamander_db-0.1.0.tar.gz
- Upload date:
- Size: 121.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66aa9e41a574d9df15fdab2b71b31ec2ad62a43cea95a17e405334b34c19f302
|
|
| MD5 |
87fd9d566e51e9447f5c5f817d88b99d
|
|
| BLAKE2b-256 |
fcba569318be4f17e5ae406dab4a40978f05337c7b19eb5a8ee2ef95e48a1310
|
Provenance
The following attestation bundles were made for salamander_db-0.1.0.tar.gz:
Publisher:
release-python.yml on rdelprete/salamander-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
salamander_db-0.1.0.tar.gz -
Subject digest:
66aa9e41a574d9df15fdab2b71b31ec2ad62a43cea95a17e405334b34c19f302 - Sigstore transparency entry: 2165102908
- Sigstore integration time:
-
Permalink:
rdelprete/salamander-db@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/rdelprete
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file salamander_db-0.1.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: salamander_db-0.1.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 686.3 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
833b2f59780d55e495b828fc84ca3d2120c0b2ddc11c32f56597e7fc3d8c2a31
|
|
| MD5 |
fae6fbae265765a0caa6184d98eb4f3c
|
|
| BLAKE2b-256 |
db0563611bdcc834bfb3fb8522f75fc6a801d449a61037fc59af949cfa6943a3
|
Provenance
The following attestation bundles were made for salamander_db-0.1.0-cp39-abi3-win_amd64.whl:
Publisher:
release-python.yml on rdelprete/salamander-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
salamander_db-0.1.0-cp39-abi3-win_amd64.whl -
Subject digest:
833b2f59780d55e495b828fc84ca3d2120c0b2ddc11c32f56597e7fc3d8c2a31 - Sigstore transparency entry: 2165102992
- Sigstore integration time:
-
Permalink:
rdelprete/salamander-db@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/rdelprete
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file salamander_db-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: salamander_db-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 857.2 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e68bbd9d3978d01cb5c42ca4be4762e13853fecc76ab6f9cb6289f75d67b043
|
|
| MD5 |
5bd4dcbbe840b82232b485ecd556fc19
|
|
| BLAKE2b-256 |
4aad157adfed70d07e0fc70285fde398fca7e1f3dea5dca6e96fdd78aa140985
|
Provenance
The following attestation bundles were made for salamander_db-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release-python.yml on rdelprete/salamander-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
salamander_db-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
1e68bbd9d3978d01cb5c42ca4be4762e13853fecc76ab6f9cb6289f75d67b043 - Sigstore transparency entry: 2165103044
- Sigstore integration time:
-
Permalink:
rdelprete/salamander-db@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/rdelprete
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file salamander_db-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: salamander_db-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 847.5 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b58df1ad0fa8424775ba1ca5749070cf875c2c4766b48c5e640c6848c52ca238
|
|
| MD5 |
2a0bc1871596bffe0cee06b01660ddbf
|
|
| BLAKE2b-256 |
b46c8165d457de63b8b2f0101f80f0158f979e2da3388fb489c74b42170fc5c5
|
Provenance
The following attestation bundles were made for salamander_db-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release-python.yml on rdelprete/salamander-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
salamander_db-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
b58df1ad0fa8424775ba1ca5749070cf875c2c4766b48c5e640c6848c52ca238 - Sigstore transparency entry: 2165102945
- Sigstore integration time:
-
Permalink:
rdelprete/salamander-db@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/rdelprete
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file salamander_db-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: salamander_db-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 761.4 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9304d2b7b7f7a14c46a8d824447e8702bc98a2f68472ead7c4be83c8a52466c
|
|
| MD5 |
67e20451f4a044dc5a990f491ceab750
|
|
| BLAKE2b-256 |
7f0554086ce20d3bb9f8c07d008aa9766fc044839617f4fc9a1b7c02c7a5850b
|
Provenance
The following attestation bundles were made for salamander_db-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release-python.yml on rdelprete/salamander-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
salamander_db-0.1.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
c9304d2b7b7f7a14c46a8d824447e8702bc98a2f68472ead7c4be83c8a52466c - Sigstore transparency entry: 2165103022
- Sigstore integration time:
-
Permalink:
rdelprete/salamander-db@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/rdelprete
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file salamander_db-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: salamander_db-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 809.7 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8487ff98fd2cbdd14b621b1b08d303301dbfcbd24de4171a4f72118f40f67d7b
|
|
| MD5 |
74fc302e18530f7c0e0637d8de585b6a
|
|
| BLAKE2b-256 |
6efb42ae4d27c1f96e61ceb3fe67461fc5cf9da4b38054a8794d9a59f4ac5f01
|
Provenance
The following attestation bundles were made for salamander_db-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release-python.yml on rdelprete/salamander-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
salamander_db-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
8487ff98fd2cbdd14b621b1b08d303301dbfcbd24de4171a4f72118f40f67d7b - Sigstore transparency entry: 2165102973
- Sigstore integration time:
-
Permalink:
rdelprete/salamander-db@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/rdelprete
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@29700728051b02f8c63f0c8d0c6de64a637dc1a1 -
Trigger Event:
push
-
Statement type: