functualize-substrate-sqlite
Status: Published — Independently installable from PyPI.
Keeps a functualize project's documents in a local SQLite database instead of in JSON files. Install it and every store follows: the freshness ledger, workflow scope records, the state inside them, the run log and shell history all move together, because there is one decision and one object handed to all of them.
Zero external dependencies beyond the standard library's sqlite3.
Installation
pip install functualize-substrate-sqlite
That is the whole setup. The plugin is discovered through its entry point and installs itself during boot; nothing needs to be imported or configured.
What it stores, and how
One table, one row per document:
CREATE TABLE documents (
key TEXT PRIMARY KEY, payload TEXT NOT NULL, revision INTEGER NOT NULL
);
That is deliberately a document store rather than a relational model of runs and
scopes. ADR-022
records why: a backend-agnostic key-value protocol can only offer the
intersection of every backend, which is worth least exactly where having a real
database is worth most. The port is read, write, lock, clear, delete,
describe over whole documents.
What SQLite buys over a file, given that shape:
revision + revision + 1 in one statement |
real compare-and-swap, so write(expect=) can refuse a stale write |
INSERT … ON CONFLICT DO UPDATE |
atomic upsert, with no read-then-write window |
BEGIN IMMEDIATE |
one lock across every document — the lock-order inversion the filesystem substrate cannot close |
| WAL journal mode | readers are not blocked by a writer |
Where the database goes
.functualize/state.db in a declared project; otherwise the XDG cache, keyed by
project id — the same question resolve_fresh_location answers for the
filesystem substrate, asked through the same call, so the two backends cannot
disagree about where a project's state lives.
Override it explicitly:
[plugin.substrate-sqlite]
db_path = "/var/lib/myapp/state.db"
API
Two public names:
-
SQLiteSubstrate— theStoreSubstrateimplementation. Construct it with a path if you want to read or write documents directly:from functualize_substrate_sqlite import SQLiteSubstrate substrate = SQLiteSubstrate("state.db") stored = substrate.read("my-key") substrate.write( "my-key", {"count": (stored.data["count"] if stored else 0) + 1}, expect=stored.revision if stored else None, )
writereturnsFalsewhenexpectno longer matches. That is an ordinary outcome, not an error: somebody wrote between your read and your write, so read again and retry. -
SQLiteSubstratePlugin— the plugin object. It installs aSQLiteSubstrateduringAPP_READYand does nothing else.
See examples/persistent_counter/ for the
read-modify-write loop in full.
Development
uv run pytest plugins/substrates/functualize-substrate-sqlite/tests/ -v
uv build --package functualize-substrate-sqlite
Release files for functualize-substrate-sqlite 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| functualize_substrate_sqlite-0.4.0.tar.gz | 19.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| functualize_substrate_sqlite-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.1 kB
Release files / functualize_substrate_sqlite-0.4.0.tar.gz
| Download URL | functualize_substrate_sqlite-0.4.0.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9efb09cec68211981f91866699ff612bf4aefc71d65970f75d0597489a605379
|
|
BLAKE2b-256 checksum How to use checksums |
513cdc761819acc62a4547da182239df78bb1bae550b5ce9122df68f1351836a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 25, 2026.
Transparency logRelease files / functualize_substrate_sqlite-0.4.0-py3-none-any.whl
| Download URL | functualize_substrate_sqlite-0.4.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5ee3fa0fdaf37b100f0d73fdf5756e7771c7c190531036b94ce231201663a0b
|
|
BLAKE2b-256 checksum How to use checksums |
8964e4ca88d6b5f37552f5e62512f1dc3cf6eeaac0fc6748a1dab00e0091f8c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 25, 2026.
Transparency log