munarium-matrix (Python)
The Python client for Munarium Matrix, the structured-evidence plane. It speaks Matrix's REST API and it is deliberately small: Matrix's whole surface is registering assets, running the three modes, and reading what happened.
Install from the repository root with Python 3.10+:
python -m pip install ./clients/matrix-python
Or from PyPI, where the package is published as munarium-matrix:
python -m pip install munarium-matrix
Published versions are recorded in the clients front door.
One runtime dependency, httpx — the same choice the server's Python client
made, for the same reasons: one library for sync and async, a timeout that is
not optional, and no transitive surprise.
Use
from munarium_matrix import MatrixClient
with MatrixClient("https://matrix.example", token="...", uid="ops@example.com") as mx:
print(mx.version().lockstep_ok) # does Matrix agree with its server?
mx.apply(open("datasource.crm.yaml").read())
mx.apply(open("contract.pipeline.yaml").read())
outcome = mx.verify("open-pipeline-by-region")
if outcome.failed:
for q in outcome.questions:
if not q.ok:
print(q.question, q.failures)
raise SystemExit(3) # the exit discipline `mxctl` uses
Async is the same surface:
from munarium_matrix import AsyncMatrixClient
async with AsyncMatrixClient("https://matrix.example", token="...") as mx:
await mx.sync("crm")
Refusals are typed
Matrix answers a refusal as RFC 9457 problem+json carrying a refusal object
with the class and the code — the closed vocabulary the whole system
rests on. They arrive as attributes, not prose:
from munarium_matrix import MatrixError
try:
mx.verify("open-pipeline-by-region")
except MatrixError as e:
if e.retryable: # unavailable | exhausted
wait = e.retry_after # seconds, when the service said
elif e.code == "not_covered": # the collection cannot answer it
...
retryable is a property and not a guess: unavailable and exhausted are
states of the world, and every other class is a statement about the request or
the assets, where repeating it changes nothing. Retrying a denied is
hammering a door that is locked on purpose.
Lockstep
version().lockstep_ok is true only when the server reports exact. That is
the one state in which an evidence id minted by this Matrix is certain to
resolve on that server — which is what a citation like
[evidence/<id>#r0003] depends on.
What this client deliberately does NOT do
Three absences, each of them a design decision rather than a missing feature:
- No sealing. A manifest is a statement about work the sealer did. An SDK
offering
seal_evidencewould invite an application to assert provenance it cannot vouch for. Sealing is Matrix's own act; evidence is read through the server's client, resolving[evidence/<id>#<row>]. - No local validation.
validate()posts the YAML and returns Matrix's own findings. A client carrying its own copy of the rules would drift from the service that enforces them, and the drift would surface as an asset that validates here and is refused there. - No SQL. Nothing on this surface takes a statement. Queries are pre-declared contracts and views, executed by name.
There is also no gRPC transport here. Matrix's gRPC plane serves Execute
alone, and Execute is service-to-service — the munarium-server calls it, not
an application. When that changes, this package grows a transport rather than a
second client.
Surface
| Area | Methods |
|---|---|
| meta | version, healthz, healthdata |
| registry | apply, validate, list_assets, get_yaml |
| sources | introspect, probe, sync |
| contracts and views | verify, verify_view |
| reconcile | reconcile, promotion_status, gate_history, promote, demote, rollback |
| audit | journal |
verify_view takes either a metric view or a native data view and tries the
metric-view route first — the caller names the view, not the route it happens
to live on. The fallback fires on a 404 or a not_covered 422, because a
missing metric view loads through the runtime and comes back as the latter; a
different 422, such as metric_view_changed, is a real answer about a view
that exists and is not retried as something else.
validate returns the service's own valid flag beside its findings, and not
not findings: three codes are advisory, so a valid asset can carry them.
sync and reconcile return a JobAccepted: Matrix queues them, so the call
returns an id rather than an outcome. Poll journal() or the run route for the
terminal state.
Versioning
This package targets Matrix 1.0.0. A version bump on the wire surface bumps
them together.
Tests
pip install -e ".[dev]"
pytest
The offline tier drives a stub transport and asserts the response shapes this
client claims to understand, which is what catches a field rename. Setting
MUNARIUM_MATRIX_TEST_URL adds a live round-trip against a real Matrix; with
it unset that test says it skipped, because a skip that prints nothing is
indistinguishable from a pass.
Metadata
Release files for munarium-matrix 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| munarium_matrix-1.1.1.tar.gz | 20.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| munarium_matrix-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.6 kB
Release files / munarium_matrix-1.1.1.tar.gz
| Download URL | munarium_matrix-1.1.1.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9cfae2a745ad8ab971df4fdeaf94f63c7c6353d13722839f4da43e5afaf8f83
|
|
BLAKE2b-256 checksum How to use checksums |
5911115cc7a1e07986cf0962c38029684f64222e6b8af1c7b8ea0fc5483bbf65
|
| 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 15, 2026.
Transparency logRelease files / munarium_matrix-1.1.1-py3-none-any.whl
| Download URL | munarium_matrix-1.1.1-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32cf19ee8d4d2227cf391bd5fbc5461b036fd11da53c7a2620c7bcbdda93fc35
|
|
BLAKE2b-256 checksum How to use checksums |
ffde0facac3ed0802dd5f8388fd2de11158b72b5831d6b49a82630e8e05d3478
|
| 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 15, 2026.
Transparency log