This release is a pre-release and may not be stable for production use.
graphlava for Python
Layered like baklava. Linked like a graph.
An embedded metagraph database for agent memory, in one file, from Python.
Statements about statements, n-ary hyperedges and nested graphs, queried with SPARQL 1.2 and Datalog. No server.
Website · Mini book · Articles · Rust core · Repository
Status: pre-release. The API is complete and tested, but nothing is on PyPI yet, and the file format is not frozen: files written now may not open in the next version.
Why graphlava
Agent frameworks keep memory as text chunks or flat triples. An agent needs more: how sure it is and where it read a fact, a meeting of three people stored as one thing, and episodes kept as graphs inside its memory. graphlava stores those three metagraph powers natively: every statement has a stable ID you can annotate (the RDF 1.2 reifier), hyperedges are one record with typed roles, and graphs nest as a DAG. Read Statement graphs: the one idea under graphlava for the model in ten minutes.
Install
pip install graphlava # once published; until then: pip install maturin && maturin develop -r
pip install "graphlava[arrow]" # with pyarrow, for Rows.to_arrow()
One abi3 wheel per platform covers CPython 3.10 and newer; a separate wheel supports free-threaded CPython 3.14t. Wheels are built for Linux (manylinux and musllinux, x86-64 and arm64), macOS and Windows. Types ship with the package (py.typed).
Quick start
import graphlava as gl
from graphlava import Durability, Namespace
EX = Namespace("http://example.org/")
with gl.Database.open("memory.glv") as db:
# A statement, then a statement about it, in one-shot requests.
works = db.submit([gl.Insert(EX.alice, EX.worksAt, EX.acme)],
durability=Durability.ORDERED).results[0] # a statement ID
db.submit([gl.Annotate(works, EX.confidence, 0.9)])
db.submit([gl.Update(works, EX.globex)]) # same ID, annotation kept
# The reifier ?r is the statement's ID.
for org, c in db.sparql("""
PREFIX : <http://example.org/>
SELECT ?org ?c WHERE { << :alice :worksAt ?org ~ ?r >> . ?r :confidence ?c }"""):
print(org, c) # http://example.org/globex 0.9
Python values map to RDF terms: str, int (any size), float, bool, Decimal, timezone-aware datetime and date become typed literals; IRI, BNode, Literal and Triple are explicit terms; Namespace builds IRIs. Statement and node IDs are gl.Id, an int subclass holding the full 64 bits.
SPARQL and Datalog
db.sparql_update("PREFIX : <http://example.org/> INSERT DATA { :a :knows :b . :b :knows :c }")
reach = db.datalog("""
@prefix : <http://example.org/> .
reach(?x, ?y) :- :knows(?x, ?y) .
reach(?x, ?z) :- reach(?x, ?y), :knows(?y, ?z) .
?- reach(:a, ?who) .""")
for (who,) in reach:
print(who)
- SPARQL 1.2 query and update: reifiers (
<< s p o ~ ?r >>), annotation syntax ({| … |}), transitiveGRAPHover nested graphs and directGRAPH!, aggregates, property paths, andSERVICE <meta:datalog>. - Datalog in Nemo-compatible syntax with stratified negation, aggregates and
@assertheads (db.datalog_update).
Large results
Rows is lazy and decodes terms only when you read them:
for batch in db.sparql(query).iter_batches(size=1024): # lists of row tuples
...
ids = db.sparql(query).ids() # IDs only, nothing decoded
table = db.sparql(query).to_arrow() # a pyarrow.Table (graphlava[arrow])
Transactions and durability
with db.write(Durability.SYNC) as w: # commits on exit, aborts on an exception
w.insert(EX.bob, EX.knows, EX.alice)
with db.read() as r: # one consistent snapshot
bob = r.lookup(EX.bob)
print(r.out(bob))
| Durability | submit / commit returns when |
|---|---|
Durability.SYNC |
the write is on disk |
Durability.ORDERED (default) |
its group commit is on disk; concurrent writers share one fsync |
Durability.RELAXED |
it is applied; a later durable commit makes it durable |
Prefer db.submit([...]) for writes: an interactive with db.write(...) block holds the single writer for at most 100 ms. Every engine call releases the GIL, so other threads keep running during a sync commit, and the package works with free-threaded Python.
Processes and fork
One process owns a database file; a second open of the same path, in any process, raises LockedError. A handle inherited across fork() raises ForkedHandleError in the child instead of corrupting the file: open the database again in the child, or use the spawn start method.
Errors
Every engine error has its own exception class carrying its fields, all under gl.Error: ConflictError, NotFoundError, LockedError, GraphCycleError, FillsRoleError (.item, .hedge), WriteTimeoutError and more.
try:
db.submit([gl.Nest(EX.g1, EX.g2), gl.Nest(EX.g2, EX.g1)])
except gl.GraphCycleError as e:
print(e)
Learn more
- graphlava.org: what graphlava is and where it is going
- Mini book: Hypergraphs and Metagraphs in Statement Graphs: 11 short chapters, from binary edges to recursive metagraphs
- Articles, including graphlava and tiramemsu
- The Python binding design and ADR 0042: binding strategy
- Other languages: Rust, Node.js, C, Swift, Kotlin
License
MIT OR Apache-2.0.
Metadata
Release files for graphlava 0.1.0a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| graphlava-0.1.0a3.tar.gz | 310.8 kB | With provenance | Details for graphlava-0.1.0a3.tar.gz |
Built distributions (wheels)
Total release size: 36.8 MB
Release files / graphlava-0.1.0a3.tar.gz
| Download URL | graphlava-0.1.0a3.tar.gz |
|---|---|
| Size | 310.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ea13ccb173c01e8346352113e7a7075325de15070a61ec8c2522b0a97554eab
|
|
BLAKE2b-256 checksum How to use checksums |
27eac46cf35d7bfb08173d09d9f24ca218bbdc279128400a922cb9672d1dbfe3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp314-cp314t-win_amd64.whl
| Download URL | graphlava-0.1.0a3-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5038200e4fb2315ecc8ba6a6e6600ef905102b6d3f08319a6d3c4f02a8821054
|
|
BLAKE2b-256 checksum How to use checksums |
77fd5b88d9f86ddd176a62c9941719f8938dcac83e75fc7c34f83deb14fb0762
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp314-cp314t-musllinux_1_2_x86_64.whl
| Download URL | graphlava-0.1.0a3-cp314-cp314t-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
983ac2f700dd3ad369746163b6b5be3e37e4635ea2aa59dadabfc14392bb53c7
|
|
BLAKE2b-256 checksum How to use checksums |
70e893db15ad1c6ac72a2105026ee6bb93901742435b3b024448c4cac69b1d68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp314-cp314t-musllinux_1_2_aarch64.whl
| Download URL | graphlava-0.1.0a3-cp314-cp314t-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
eff41479bab9faa3da501b7c3f27e16f99e98a749aeebbdf0c4c236dafec7f24
|
|
BLAKE2b-256 checksum How to use checksums |
942f29bf541a64618c1bd96d95c2d11992ce277c190c0a9f4a030a4aca1e8fd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp314-cp314t-manylinux_2_28_x86_64.whl
| Download URL | graphlava-0.1.0a3-cp314-cp314t-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
7fbc14783b47948b3eba5f1446d63b4fc6ae5f1b129a013e93ea1c27883a2a3c
|
|
BLAKE2b-256 checksum How to use checksums |
1a34874abbf6f172c75760ad12a46e103355ff8292e5fdbc17069b6fc07db45d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp314-cp314t-manylinux_2_28_aarch64.whl
| Download URL | graphlava-0.1.0a3-cp314-cp314t-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
7699c0485185e82aa91c069b5bc1a62a7b3865d7f5b3b7a9a8670386692c5656
|
|
BLAKE2b-256 checksum How to use checksums |
616c27931337bb2354c3927660681887ed68c9116bc1c840024cbc5d23068893
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp314-cp314t-macosx_11_0_x86_64.whl
| Download URL | graphlava-0.1.0a3-cp314-cp314t-macosx_11_0_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
31675bb3b0e7a913f35a07b509dea501fa1c72599d1c7271a0b051af1e6a5353
|
|
BLAKE2b-256 checksum How to use checksums |
54c4ef74fd2c533381155b4070a60a4417153582b0c7c3bce7b6cff97660b920
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp314-cp314t-macosx_11_0_arm64.whl
| Download URL | graphlava-0.1.0a3-cp314-cp314t-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1878428d0571110a027f01854eb9c4f853fc780fe7b687bfcffed96db80275a2
|
|
BLAKE2b-256 checksum How to use checksums |
d309d7fd08985edc32722ce38fb44054d82caa0e70c6be110f66b6c42d4cf936
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp310-abi3-win_amd64.whl
| Download URL | graphlava-0.1.0a3-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
aeda0c21fee96af92cd168af54897eac745d9b26b53c8441c997926bf8816fe0
|
|
BLAKE2b-256 checksum How to use checksums |
99378bfc1d63e6152dcdbf3e723dbc93728e79d129da9a90b43ccd9f5b82f3d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | graphlava-0.1.0a3-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f7938cdec62a6fa9d74bb7d1a90fdd4a5e5d44186df86206fadab01d9e5ab13a
|
|
BLAKE2b-256 checksum How to use checksums |
3a699bb8491f4a6483eb15164dff02ec6bf2d83191981a456d12893821b97402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | graphlava-0.1.0a3-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
9ce8ff20d609ba716edfde6f9102b9e262c64111a0f08f384079f37697dc89ee
|
|
BLAKE2b-256 checksum How to use checksums |
8b2aa5d58dd62bfed114aa19f6a5f498f2acecc80ff9c2563eac3ccedf359191
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | graphlava-0.1.0a3-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7ac2b26c386f0db7e5057a50f3c90ba44c6b941a71b00e498f3ae8f640862d83
|
|
BLAKE2b-256 checksum How to use checksums |
f2d43244c902fa299c083210bb1323ca2f512bc428cbd2102ed3a364980cd7ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | graphlava-0.1.0a3-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
52f5d89b114c52e3a549d54c09e0e94c0abdf297bd08bfc8c5edc41ce05f1d96
|
|
BLAKE2b-256 checksum How to use checksums |
f1539ae7a3508fa9b802eea17445d8892e78b42575eaa95e26916db93c715bda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp310-abi3-macosx_11_0_x86_64.whl
| Download URL | graphlava-0.1.0a3-cp310-abi3-macosx_11_0_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
4f8935bbbe80f24c450c28f8033844e29394e35e19d65ad621552a1776a83660
|
|
BLAKE2b-256 checksum How to use checksums |
86a1c0e23c0aee7142b0419dca73be5afbcbcadb48d2de2c54ffdb984b76125a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / graphlava-0.1.0a3-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | graphlava-0.1.0a3-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a7e6d8bf3f5b8c8e4c6fe448a7981f3f39dd8ff3a2133aec1a025e369abb86da
|
|
BLAKE2b-256 checksum How to use checksums |
4a61869255e48646451d7c600bbba1b1e551333f21250f6d1fb6853d0a7dd5cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for graphlava 0.1.0a3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 15 files in this release have been uploaded with provenance metadata.
Attestation for graphlava-0.1.0a3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.