Python loader, reducer, and verifier for Vela scientific frontier state. Cross-impl mirror of the Rust substrate.
Project description
Vela Python client
Cross-implementation reducer + loader for the Vela protocol. The
authoritative implementation is the Rust workspace under
crates/vela-protocol/; this Python module mirrors the kernel
behavior so a third-party Python tool can replay a frontier's
event log and load a split-repo without depending on the Rust
binary.
The cross-impl invariant is: given the same canonical event log and the same Carina kernel digest, the Rust reducer and the Python reducer produce byte-equivalent finding-state digests. This is the load-bearing property that lets Vela claim "the protocol is implementation-portable."
What's here
-
vela_reducer.py: the reducer dispatch. Accepts a canonicalStateEventJSON dict + a Project state dict, applies the reducer arm for the event'skind, mutates state in place. Mirrorscrates/vela-protocol/src/reducer.rs::apply_event. -
vela_loader.py: the split-repo loader. Reads.vela/findings/,.vela/events/,.vela/proposals/, plusfrontier.yaml, populatesproject.dependenciesfrom the v0.59frontiers_v2schema, replays events through the reducer. Mirrorscrates/vela-protocol/src/repo.rs::load_vela_repo. Yaml is parsed viapyyamlif present; otherwise a hand-rolled parser narrow to the manifest's exact shape. -
tests/test_loader_frontiers_v2.py: integration test asserting the loader produces the same dependency state + finding state the Rust loader does on a real frontier (projects/early-ad-biomarker-calibration).
Usage
from vela_loader import load_frontier_repo
project = load_frontier_repo("/path/to/projects/early-ad-biomarker-calibration")
# project is a dict with keys:
# project: { name, description, dependencies }
# frontier_id, findings, events, proposals
# review_events, confidence_updates, manifest
# negative_results, trajectories, artifacts, evidence_atoms
print(f"frontier: {project['project']['name']} ({project['frontier_id']})")
print(f"findings: {len(project['findings'])}")
print(f"events: {len(project['events'])}")
print(f"deps: {len(project['project']['dependencies'])}")
What's NOT here (honest gaps)
The Python loader does not currently rehydrate every field the Rust loader does. Specifically missing:
vela.lock(lockfile parsing).actors.json,peers.json(federation surfaces).proof-state.json.signatures/,replications/,datasets/,code-artifacts/,predictions/,resolutions/,artifacts/.- The v0.55 trajectories+nulls materialization.
- The v0.56 evidence-atom locator materialization.
.vela/links/manifest.jsonredistribution.project::recompute_stats.
These are real gaps. The cross-impl invariant currently holds at the finding-state-digest level only; full Project parity is a follow-on cycle. Anyone implementing a third Vela language binding should target the same subset first and document their gaps as honestly.
Running the test
The test runs without pytest if needed:
python3 clients/python/tests/test_loader_frontiers_v2.py
Or with pytest:
python3 -m pytest clients/python/tests/
Cross-impl correctness
The fixture harness is Rust-side at
crates/vela-protocol/tests/cross_impl_reducer_fixtures.rs.
Each fixture builder generates an event log; the test exports
the same logs to JSON for the Python reducer to replay; the
finding-state digests must match byte-for-byte. The test file's
fixture_coverage_includes_every_reducer_arm assertion
verifies every kind in REDUCER_MUTATION_KINDS has a fixture
builder. New kinds added to the Rust reducer must be reflected
in this Python module (a no-op match arm is sufficient if the
kind doesn't mutate finding state) and in the fixture builders.
Doctrine
The Python loader is a mirror, not the spec. When the Rust and
Python reducers disagree, the Rust implementation is
authoritative; the Python side is the bug. The cross-impl test
catches the disagreement; the spec at docs/PROTOCOL.md
documents the canonical behavior.
No silent edits. No event-log mutation. No version-skew silently glossed; if a new kind appears in the event log that the Python dispatch doesn't know, the loader raises rather than silently dropping the event.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 vela_state-0.102.0.tar.gz.
File metadata
- Download URL: vela_state-0.102.0.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ccc1afe5e89bfc1b08dab2aba130fa000d29516530e474a556e1369e81e25c0
|
|
| MD5 |
0b19196b8b064b6ac2d225d1b7cecf34
|
|
| BLAKE2b-256 |
179e9115d7d87fa8badbe5870be7e18482c69962c1bc6a47f15ddf203a3d2515
|
File details
Details for the file vela_state-0.102.0-py3-none-any.whl.
File metadata
- Download URL: vela_state-0.102.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
038522f7aec8cc76347b64cc51a0e9273242d19d2dd4efc64aea1e04e368e72a
|
|
| MD5 |
29dfef9ed69a3ed5c06af94e4d26ed2f
|
|
| BLAKE2b-256 |
082930f95553c0b942cd42ef12bc2d6e9a7b39338cbd3d8423baf5ffc067f287
|