From 9202b33fd248a5e417e1085c02accc480e0bec15 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 13 Jun 2026 22:36:12 +0100 Subject: [PATCH] Mark Python runtime package typed --- packages/cultcache-py/README.md | 53 ++++++++++++++++--- packages/cultcache-py/pyproject.toml | 7 ++- .../cultcache-py/src/cultcache_py/py.typed | 1 + .../cultcache-py/src/cultmesh_py/py.typed | 1 + packages/cultcache-py/src/cultnet_py/py.typed | 1 + 5 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 packages/cultcache-py/src/cultcache_py/py.typed create mode 100644 packages/cultcache-py/src/cultmesh_py/py.typed create mode 100644 packages/cultcache-py/src/cultnet_py/py.typed diff --git a/packages/cultcache-py/README.md b/packages/cultcache-py/README.md index 57bc9f7d..919735f6 100644 --- a/packages/cultcache-py/README.md +++ b/packages/cultcache-py/README.md @@ -21,7 +21,8 @@ It is intentionally small. It is not an ORM, a database, or distributed consensu - `define_database_entry_type(...)` emits Rust/C#-style slot-indexed MessagePack array payloads for cross-runtime `DatabaseEntry` contracts - `cultnet_py` exposes schema-v0 MessagePack helpers and 4-byte big-endian - frame helpers + frame helpers for raw document state, subscriptions, shard catch-up, + simulation observations, and witness artifact bundles - `cultmesh_py` exposes a cache-backed local node surface for Python tools ## Example @@ -144,10 +145,43 @@ member order. `cultnet_py` provides the Python schema-v0 wire helpers and an interop peer: ```python -from cultnet_py import decode_frame, encode_frame, hello, parse_message +from cultnet_py import ( + compute_simulation_claim_hash, + database_subscribe, + decode_frame, + encode_frame, + hello, + parse_message, + shard_catalog_request, + simulation_observation, + witness_artifact_bundle, +) payload = hello(runtime_id="python-runtime").to_bytes() message = parse_message(decode_frame(encode_frame(payload))) + +subscription = database_subscribe(subscription_id="ui", schema_ids=["cultnet.interop-note"]) +shards = shard_catalog_request(message_id="shards", schema_ids=["cultnet.interop-note"]) +claim_hash = compute_simulation_claim_hash("frame:42", "subject:player-1", "hit") +observation = simulation_observation( + message_id="obs-1", + witness_runtime_id="python-runtime", + shard_id="interop", + shard_epoch=1, + frame=42, + subject_id="player-1", + claim_kind="hit", + claim_hash=claim_hash, +) +witness = witness_artifact_bundle( + bundle_id="bundle-1", + witness_kind="interop-proof", + captured_at="2026-06-13T00:00:00Z", + subject={"documentType": "cultnet.interop-note", "subjectId": "note:python"}, + contracts=[{"role": "payload", "schemaId": "cultnet.interop-note"}], + artifacts=[{"role": "log", "uri": "cultcache://bundle-1/log", "mediaType": "text/plain"}], + provenance={"pipelineId": "interop", "runId": "run-1", "runtimeId": "python-runtime"}, +) ``` The peer can serve, dial, and probe the same raw-state interop lane used by the @@ -193,8 +227,15 @@ Current receipts: CultCache v1 parity matrix with TypeScript, Rust, and C#. - `packages/cultnet-ts/test/interop/cultnet-interop.test.ts` includes Python in the live TS/Rust/C#/Python schema-v0 peer ring: discovery, hello, schema - catalog, raw snapshot, raw document put, mutation receipt, and fire-command - receipt. The same test asks the Python peer for CultMesh Verse catalog and - peer exchange responses over the CultNet pipe. + catalog, raw snapshot, raw document put, mutation receipt, fire-command + receipt, database subscription changes, shard catalog, shard log catch-up, + simulation consensus candidates, and witness artifact bundle round-trips. The + same test asks the Python peer for CultMesh Verse catalog and peer exchange + responses over the CultNet pipe. - `packages/cultcache-py/tests/test_cultcache.py` covers Python CultMesh - Verse catalog, peer exchange, authority lease, and stream negotiation behavior. + Verse catalog, peer exchange, authority lease, stream negotiation, CultNet + helper shapes, simulation claim hashing, and witness artifact bundle payload + slots. +- `cultcache_py`, `cultnet_py`, and `cultmesh_py` ship `py.typed` markers so + downstream type checkers can inspect the package surface instead of treating + the runtime as an untyped xenos swamp. diff --git a/packages/cultcache-py/pyproject.toml b/packages/cultcache-py/pyproject.toml index d1d1e6c4..7769e8fc 100644 --- a/packages/cultcache-py/pyproject.toml +++ b/packages/cultcache-py/pyproject.toml @@ -1,4 +1,4 @@ -[build-system] +[build-system] requires = ["setuptools>=68"] build-backend = "setuptools.build_meta" @@ -27,3 +27,8 @@ cultnet-py-interop = "cultnet_py.interop_peer:main" [tool.setuptools.packages.find] where = ["src"] + +[tool.setuptools.package-data] +cultcache_py = ["py.typed"] +cultnet_py = ["py.typed"] +cultmesh_py = ["py.typed"] diff --git a/packages/cultcache-py/src/cultcache_py/py.typed b/packages/cultcache-py/src/cultcache_py/py.typed new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/cultcache-py/src/cultcache_py/py.typed @@ -0,0 +1 @@ + diff --git a/packages/cultcache-py/src/cultmesh_py/py.typed b/packages/cultcache-py/src/cultmesh_py/py.typed new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/cultcache-py/src/cultmesh_py/py.typed @@ -0,0 +1 @@ + diff --git a/packages/cultcache-py/src/cultnet_py/py.typed b/packages/cultcache-py/src/cultnet_py/py.typed new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/cultcache-py/src/cultnet_py/py.typed @@ -0,0 +1 @@ +