PyO3-backed Manyfold RFC scaffolding and in-memory runtime.
Project description
manyfold
Manyfold is a component library for execution graphs.
It helps make graph-shaped programs easier to build, inspect, and explain. Routes, schemas, buffers, demand, time, payload access, writes, taints, and lineage are modeled as graph concerns instead of being hidden in callback code or queue configuration.
Think of it as a logical board: routes are traces, ports are pads, components shape execution, and overlapping regions show where ownership, policy, and data flow meet.
This repository is an RFC-stage Python package with a PyO3/Rust extension. It is not a production runtime yet, but the package is runnable and the examples exercise the supported surface.
Start Fast
uv sync
uv run python examples/simple_latest.py
uv run python -m unittest tests.test_examples
A Small Graph in Motion
Publish Values
from manyfold import Graph, Schema, route
graph = Graph()
temperature = route(
owner="sensor",
family="environment",
stream="temperature",
schema=Schema.bytes(name="Temperature"),
)
graph.publish(temperature, b"72.4F")
graph.publish(temperature, b"72.9F")
latest = graph.latest(temperature)
assert latest is not None
print(f"latest #{latest.closed.seq_source}: {latest.value!r}")
Output:
latest #2: b'72.9F'
The fields are the parts of the graph name:
owneris the component or subsystem responsible for the signal.familygroups related streams.streamnames this specific signal.schemasays how payloads are encoded and decoded.
Basic routes default to read/logical/meta, so the first example stays focused
on the moving signal. Pass explicit plane, layer, or variant when that
role matters.
Stats: Compute Values
temperature = route(
owner="sensor",
family="environment",
stream="temperature",
schema=Schema.float(name="Temperature"),
)
average_temperature = temperature.derivative_route(
stream="average_temperature",
schema=Schema.float(name="AverageTemperature"),
)
subscription = graph.observe(temperature, replay_latest=False).moving_average(
window_size=3
).connect(average_temperature)
for reading in (72.4, 72.9, 73.7):
graph.publish(temperature, reading)
subscription.dispose()
latest_average = graph.latest(average_temperature)
assert latest_average is not None
print(f"average: {latest_average.value:.1f}F")
node = next(
node
for node in graph.diagram_nodes()
if dict(node.metadata).get("statistic") == "moving_average"
)
print(dict(node.metadata))
Output:
average: 73.0F
{'statistic': 'moving_average', 'storage': 'sliding_capacitor', 'window_size': '3'}
The shape is the same: computed values are just values published to another typed route. The moving average also renders as a graph-visible node backed by a sliding capacitor, so derived state and operational inspection stay in the same vocabulary.
Model Consensus
from manyfold import Consensus
consensus = Consensus.install(graph, nodes=("node-a", "node-b"))
consensus.tick(1)
consensus.tick(2)
consensus.propose(1, "set mode=auto")
consensus.propose(2, "set temp=21")
print(consensus.latest_leader())
print(consensus.latest_log())
Output:
('node-a', 3, True)
((1, 'set mode=auto'), (2, 'set temp=21'))
The consensus component uses Raft-shaped leader election and replicated-log concepts from Diego Ongaro and John Ousterhout's “In Search of an Understandable Consensus Algorithm” (USENIX ATC 2014).
Read Next
- Onboarding: repo setup, first commands, and where to look first.
- Using Manyfold: routes, graphs, observation, flow components, and examples.
- Performance: how to represent performance concerns as graph concerns.
- Distributed systems catalog: higher-level component ideas.
- Wiregraph RFC: the larger design target.
What It Models
- Typed routes for logical signals.
- Replayable latest-value reads and Rx-style observation.
- Graph-visible node thread placement for main, background, pooled, or isolated execution.
- Graph-visible capacitors, resistors, watchdogs, mailboxes, windows, and joins.
- Explicit demand, retention, lazy payload access, and write-shadow state.
- Lineage, taints, route audit snapshots, and topology queries.
- Local file-backed stores and a small consensus component scaffold.
The public Python surface is intentionally narrow at the top level. Advanced
helpers live under manyfold.graph, and the examples are the best way to see
which parts are supported today.
Examples
The examples/ directory is organized as a short path through the mental
model. Start with a route, derive values, add explicit demand, then move
into joins, watermarks, planning, consensus, and taint-aware runtime behavior. The supported
examples are validated by the regular unittest run so they do not drift
away from the API.
Start here: publish changing state and read the latest value
- examples/simple_latest.py: Smallest changing-signal publish/read-back example.
Layer computation: publish derived values
- examples/average_temperature.py: Compute and publish a rolling average from temperature samples.
Control the flow: make downstream demand visible
- examples/rate_matched_sensor.py: A one-slot capacitor coalesces bursty reads behind explicit demand.
Fuse streams: coordinate independent sensors
- examples/imu_fusion_join.py: Capacitors stage accelerometer and gyro streams before an event-time join.
Reason in time: release data by watermark progress
- examples/rolling_window_aggregate.py: A capacitor discharges samples behind explicit event-time watermarks.
Scale the graph: plan repartition work explicitly
- examples/cross_partition_join.py: A repartition join with skew metrics and planner output.
Capstone: wire a Raft-shaped consensus component
- examples/raft_demo.py: The Consensus component wires Raft election defaults from graph primitives.
Audit the hard parts: mark nondeterminism on purpose
- examples/ephemeral_entropy_stream.py: Per-request entropy derivation that taints determinism explicitly.
More involved operator, query, transport, mesh, and security coverage stays in tests/test_graph_reactive.py, with archived exploratory scripts kept under examples/archived/. The example manifest, README featured-example list, and RFC reference suite all derive from the shared example catalog, so supported versus archived status lives in one place.
Verify
Use uv run for Python commands.
cargo test
uv run ruff check
uv run python -m unittest discover -s tests -p 'test_*.py'
uv run python -m manyfold.rfc_checklist_gen --check
uv run manyfold-example-catalog --check
uv run python -m examples.catalog --check-readme
Repo Map
python/manyfold/: Python wrapper API.src/: Rust in-memory runtime and PyO3 extension.examples/: runnable examples covered by tests.tests/:unittestsuite.docs/: onboarding, usage, performance notes, release notes, and RFC docs.
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 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 manyfold-0.1.26.tar.gz.
File metadata
- Download URL: manyfold-0.1.26.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
319f28f9b9b527f2de869eb70c5c9065a4dd91cbc5972644cb3d55a5b6fffb59
|
|
| MD5 |
b2fb969e3d1a4ea1f46d571fda3ba17c
|
|
| BLAKE2b-256 |
0487d07dfbb6af712ada837a36d7290abc12d1e8ed8ee1e9b705cf222d738d84
|
Provenance
The following attestation bundles were made for manyfold-0.1.26.tar.gz:
Publisher:
pypi.yml on Organization5762/manyfold
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
manyfold-0.1.26.tar.gz -
Subject digest:
319f28f9b9b527f2de869eb70c5c9065a4dd91cbc5972644cb3d55a5b6fffb59 - Sigstore transparency entry: 1450103405
- Sigstore integration time:
-
Permalink:
Organization5762/manyfold@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Branch / Tag:
refs/tags/v0.1.26 - Owner: https://github.com/Organization5762
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Trigger Event:
release
-
Statement type:
File details
Details for the file manyfold-0.1.26-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: manyfold-0.1.26-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 428.8 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbcc98d938f966e65a9f565b0d83e0f3e01b31891a838f16d2bab9eae7cf5916
|
|
| MD5 |
fca5e68683e376deacb003f33342c351
|
|
| BLAKE2b-256 |
61aeb580dd99c3c8022f8f1d85c8821b50f779771f0b5cb5a6ffba00077a2de1
|
Provenance
The following attestation bundles were made for manyfold-0.1.26-cp310-abi3-win_amd64.whl:
Publisher:
pypi.yml on Organization5762/manyfold
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
manyfold-0.1.26-cp310-abi3-win_amd64.whl -
Subject digest:
bbcc98d938f966e65a9f565b0d83e0f3e01b31891a838f16d2bab9eae7cf5916 - Sigstore transparency entry: 1450104185
- Sigstore integration time:
-
Permalink:
Organization5762/manyfold@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Branch / Tag:
refs/tags/v0.1.26 - Owner: https://github.com/Organization5762
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Trigger Event:
release
-
Statement type:
File details
Details for the file manyfold-0.1.26-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: manyfold-0.1.26-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 594.2 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e2290de9ba8047c5d65a4b4949efb11a59fc1dd0263e136c556fc182e22b668
|
|
| MD5 |
0ea4663a278636fa39cc47794ca78fea
|
|
| BLAKE2b-256 |
78c87f6c377201a302da20e172bf1375560388956e0f466edf827ed59dfe49d8
|
Provenance
The following attestation bundles were made for manyfold-0.1.26-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
pypi.yml on Organization5762/manyfold
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
manyfold-0.1.26-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
6e2290de9ba8047c5d65a4b4949efb11a59fc1dd0263e136c556fc182e22b668 - Sigstore transparency entry: 1450104292
- Sigstore integration time:
-
Permalink:
Organization5762/manyfold@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Branch / Tag:
refs/tags/v0.1.26 - Owner: https://github.com/Organization5762
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Trigger Event:
release
-
Statement type:
File details
Details for the file manyfold-0.1.26-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: manyfold-0.1.26-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 542.6 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06c1e2c716c2e6ee603c36d0c2b61e4e6633cf23aedd28120da022ade9f62f25
|
|
| MD5 |
9c8416f857876ebb43cb8216b03bdabe
|
|
| BLAKE2b-256 |
fd3a24123ea556e24de88faee178fea42085101f15e7287db41c9545a35183af
|
Provenance
The following attestation bundles were made for manyfold-0.1.26-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
pypi.yml on Organization5762/manyfold
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
manyfold-0.1.26-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
06c1e2c716c2e6ee603c36d0c2b61e4e6633cf23aedd28120da022ade9f62f25 - Sigstore transparency entry: 1450103680
- Sigstore integration time:
-
Permalink:
Organization5762/manyfold@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Branch / Tag:
refs/tags/v0.1.26 - Owner: https://github.com/Organization5762
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Trigger Event:
release
-
Statement type:
File details
Details for the file manyfold-0.1.26-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: manyfold-0.1.26-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 552.7 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
648d1489a5b5bb6a2ff94c3d5d86850199b8fca6b92e3b8df3265edb45ff4331
|
|
| MD5 |
8d1c8161255df5df73a756b802342318
|
|
| BLAKE2b-256 |
b199dbb8b8e1120adc48a6def5707ee9867df88e2165b3ad8f964cd9bee2d712
|
Provenance
The following attestation bundles were made for manyfold-0.1.26-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
pypi.yml on Organization5762/manyfold
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
manyfold-0.1.26-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
648d1489a5b5bb6a2ff94c3d5d86850199b8fca6b92e3b8df3265edb45ff4331 - Sigstore transparency entry: 1450103950
- Sigstore integration time:
-
Permalink:
Organization5762/manyfold@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Branch / Tag:
refs/tags/v0.1.26 - Owner: https://github.com/Organization5762
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@2616cb0c1b804a6a4c8de48af57e944527e49d11 -
Trigger Event:
release
-
Statement type: