Corium Python client
corium is the asynchronous Python API for both Corium deployment modes:
LocalPeerruns a full peer in-process.RemotePeerconnects tocorium peer-server.
Both satisfy the same runtime-checkable Peer protocol and return immutable
Db values. The native extension connects LocalPeer directly to Corium's
peer library and RemotePeer to corium peer-server.
from corium import LocalPeer, Query
async with await LocalPeer.connect(
"http://127.0.0.1:4334",
database="people",
) as peer:
db = await peer.db()
rows = await db.query(Query.find("?name").where("?entity", ":person/name", "?name"))
Explicit close() (or async with) is required for deterministic shutdown.
Wall-clock database views accept timezone-aware, millisecond-precision
datetime values only. Custom Tagged values may use any tag except bytes,
eid, inst, and uuid, which are reserved for dedicated boundary types.
https:// endpoints automatically enable platform TLS roots, and bearer
tokens are rejected for plaintext http:// endpoints by default. Local
development may opt in explicitly with allow_insecure_token=True. Every
endpoint must include an http:// or https:// scheme. Datom scans use
limit=None for an explicitly unbounded scan.
Query, Pull, and transaction builders
All builders are immutable: every fluent method returns a new value, and
Db.query, Db.pull, and Peer.transact accept either builders or the
existing raw data-form escape hatches.
from corium import (
EntityMap,
Pull,
Query,
TxBuilder,
data,
gte,
lookup,
tempid,
)
tx = (
TxBuilder()
.entity(
EntityMap.with_id(tempid("ada")).set("person/name", "Ada").set("person/age", 36)
)
.build()
)
report = await peer.transact(tx)
adults = (
Query.find_collection("?name")
.in_scalar("?minimum")
.where(data("?entity", ":person/name", "?name"))
.where("?entity", ":person/age", "?age")
.where(gte("?age", "?minimum"))
)
names = await report.db_after.query(adults, 18)
person = await report.db_after.pull(
Pull().db_id().attr("person/name").attr("person/age"),
lookup("person/name", "Ada"),
)
Query builders cover relation, collection, tuple, and scalar results; scalar,
tuple, collection, relation, database, and rule inputs; data patterns;
predicates and functions; not, not-join, or, and or-join; rules; Pull
find expressions; and aggregates. Strings beginning with ? are variables,
strings beginning with : are keywords, and _ is the blank term. Use
lit(...) when one of those spellings must remain a string literal.
Pull builders cover wildcard and entity-id selections, reverse references,
nested patterns, bounded and unbounded recursion, aliases, defaults, and
limits. Transaction builders cover entity maps, temporary IDs, lookup
references, explicit EntityId values, add/retract/CAS/retract-entity
operations, and arbitrary raw forms.
See examples/people.py for a complete topology-neutral
example. The package includes py.typed, so these APIs are visible to static
type checkers without a separate stub distribution.
Private PKI deployments can add a PEM certificate authority and override the certificate DNS name without replacing the platform trust store:
from pathlib import Path
peer = await RemotePeer.connect(
"https://127.0.0.1:4336",
database="people",
token="secret",
tls_ca=Path("ca.pem").read_bytes(),
tls_domain="corium.internal",
)
Direct storage
LocalPeer normally reconstructs its in-process database from the transactor's
gapless transaction stream. For faster cold starts, DirectStorage asks the
transactor for a separately usable, read-only storage connection and loads the
latest published snapshot before subscribing to the remaining transaction tail:
from corium import DirectStorage, LocalPeer, SegmentCache
peer = await LocalPeer.connect(
"https://transactor.example.com",
database="people",
token=token,
storage=DirectStorage(
cache=SegmentCache(
"/var/cache/corium/people",
capacity_bytes=256 * 1024**3,
)
),
)
Filesystem storage is present in the corium package. Install the package for
the storage backend that the transactor uses:
python -m pip install corium corium-turso
# Or install corium-postgres or corium-s3.
Install all packages before the Python process starts. Corium loads each
installed plugin through the corium.store_plugins entry-point group.
Make sure that the required backend is available:
from corium import available_storage_backends
assert "turso" in available_storage_backends()
Then pass DirectStorage to LocalPeer.connect, as shown in the first example.
The transactor supplies the separate read-only configuration for the backend.
You do not import the plugin package or give Corium a library path.
available_storage_backends() reports all loaded backends. A missing backend
causes a StorageError when LocalPeer connects.
WARNING: Install plugins only from trusted publishers. A plugin runs native code in the Python process and can receive storage credentials.
Filesystem and Turso advertise local paths, so their direct-storage peers must
run on a host that can reach the same path as the transactor. Corium rejects a
missing store with StorageError; it does not create an empty store or silently
fall back to replaying the full transaction stream.
PostgreSQL and S3 discovery never reuses the transactor's write credentials.
The transactor must advertise its separately configured read-only PostgreSQL
URL or S3 credentials. Temporary S3 credentials are refreshed through
GetStorageInfo, and a refresh is rejected if the bucket, prefix, region, or
endpoint changes.
The native integration suite uses the same workload for local and remote peers:
query result conversion, Pull, datom scans, immutable views, stable caller-error
mapping, transactions, and deterministic close. Set
CORIUM_TEST_LOCAL_ENDPOINT and/or CORIUM_TEST_REMOTE_ENDPOINT to run it
against live services. The dedicated private-CA and bearer-auth test uses
CORIUM_TEST_REMOTE_TLS_ENDPOINT, CORIUM_TEST_REMOTE_TLS_TOKEN,
CORIUM_TEST_REMOTE_TLS_CA, and optionally
CORIUM_TEST_REMOTE_TLS_DOMAIN/CORIUM_TEST_REMOTE_BAD_TOKEN.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 corium-0.1.80-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: corium-0.1.80-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ce79156f33c53e9e7486f6d6d985d522ecc4f78880778892a34e8565984a9d6
|
|
| MD5 |
2d2a1ae69b7534716eaead728491e5d3
|
|
| BLAKE2b-256 |
bce4c29e1b6445a70be0127db7c63edd7f33967d553e8777fffdbd15abc93c5c
|
Provenance
The following attestation bundles were made for corium-0.1.80-cp310-abi3-win_amd64.whl:
Publisher:
publish.yml on csm/corium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
corium-0.1.80-cp310-abi3-win_amd64.whl -
Subject digest:
0ce79156f33c53e9e7486f6d6d985d522ecc4f78880778892a34e8565984a9d6 - Sigstore transparency entry: 2342013758
- Sigstore integration time:
-
Permalink:
csm/corium@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/csm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Trigger Event:
push
-
Statement type:
File details
Details for the file corium-0.1.80-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: corium-0.1.80-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfa4387954ebe9346d421eb81fd0d8367ce859d4f21e709469e1ca8081de5168
|
|
| MD5 |
91de804b12df1815c0dbef5a681c65a4
|
|
| BLAKE2b-256 |
7a6131328b767c3a2bd7cbcfe0c16ea5d55188f61b6950ba7b0e79113b5ec0c2
|
Provenance
The following attestation bundles were made for corium-0.1.80-cp310-abi3-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on csm/corium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
corium-0.1.80-cp310-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
cfa4387954ebe9346d421eb81fd0d8367ce859d4f21e709469e1ca8081de5168 - Sigstore transparency entry: 2342013775
- Sigstore integration time:
-
Permalink:
csm/corium@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/csm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Trigger Event:
push
-
Statement type:
File details
Details for the file corium-0.1.80-cp310-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: corium-0.1.80-cp310-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d3bce6038f7da6fa5308b366f1869bc5279dc8904ece5053bf3e7235b18af46
|
|
| MD5 |
c51f44df82e3f5703d5fa4953645b3cb
|
|
| BLAKE2b-256 |
39d209171d6d4fe1ea6345617799a3a724d9e712312ae6612e472aa400c79d7e
|
Provenance
The following attestation bundles were made for corium-0.1.80-cp310-abi3-manylinux_2_28_aarch64.whl:
Publisher:
publish.yml on csm/corium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
corium-0.1.80-cp310-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
9d3bce6038f7da6fa5308b366f1869bc5279dc8904ece5053bf3e7235b18af46 - Sigstore transparency entry: 2342013748
- Sigstore integration time:
-
Permalink:
csm/corium@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/csm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Trigger Event:
push
-
Statement type:
File details
Details for the file corium-0.1.80-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: corium-0.1.80-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47ead721a514161b8308f78674ff1bb493db7257c4b8c94a1cd1ad8c481fbe4a
|
|
| MD5 |
e27efe0da14c166e6a46b67a0060a59d
|
|
| BLAKE2b-256 |
b8fad0221cd9c678d24a6eca350600b4efff4931c7791604223c6bf245ecc4bb
|
Provenance
The following attestation bundles were made for corium-0.1.80-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on csm/corium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
corium-0.1.80-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
47ead721a514161b8308f78674ff1bb493db7257c4b8c94a1cd1ad8c481fbe4a - Sigstore transparency entry: 2342013752
- Sigstore integration time:
-
Permalink:
csm/corium@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/csm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Trigger Event:
push
-
Statement type:
File details
Details for the file corium-0.1.80-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: corium-0.1.80-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4afb9f1f3db5e1c916838200a90421dc76f1f60597a80fea14a6b8364cb11425
|
|
| MD5 |
a6a3fe6272277d5057eba5cc5fc3dfad
|
|
| BLAKE2b-256 |
4f07dc12e9f53b658e62caa592bae1745b423f94e6e1e95c9a459ce6c4ef76ef
|
Provenance
The following attestation bundles were made for corium-0.1.80-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on csm/corium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
corium-0.1.80-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
4afb9f1f3db5e1c916838200a90421dc76f1f60597a80fea14a6b8364cb11425 - Sigstore transparency entry: 2342013739
- Sigstore integration time:
-
Permalink:
csm/corium@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/csm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43ba0d060669b9b58a562d6cc6c65cc319db0037 -
Trigger Event:
push
-
Statement type: