A flow-based development (FBD) runtime system.
Project description
netrun
A flow-based development (FBD) runtime for Python. Define networks of interconnected nodes, and netrun handles packet routing, worker pool execution, caching, and lifecycle management — powered by netrun-sim for deterministic packet flow simulation.
Key Features
- Flow-based execution — Define graphs of nodes connected by ports and edges; packets flow automatically based on salvo conditions
- Multiple pool types — Execute nodes across threads, processes, or remote workers via WebSockets
- Node factories — Create nodes from regular Python functions (
functionfactory) or fan-out patterns (broadcastfactory) - Signals and controls — Pause, resume, and control network execution at runtime
- Caching and storage — Cache epoch results, store packet data to local/S3/SSH/GCS backends
- Node variables — Typed, inheritable configuration variables with environment variable support
- Output queues — Collect results from terminal nodes
- CLI — Validate configs, inspect graphs, convert formats, and query factory info
- Config formats — Define networks in JSON or TOML with
NetConfig.from_file()
Installation
cd netrun
uv sync
Quick Example
Define a network in TOML:
# my_net.toml
[pools.main]
id = "main"
[pools.main.spec]
type = "main"
[[graph.nodes]]
factory = "netrun.node_factories.function"
[graph.nodes.factory_args]
func = "mymodule.process"
[graph.nodes.execution_config]
pools = ["main"]
[output_queues.results]
ports = [["process", "out"]]
Run it:
import asyncio
from netrun.net.config import NetConfig
from netrun.net._net import Net
async def main():
config = NetConfig.from_file("my_net.toml")
async with Net(config) as net:
net.inject_data("process", "x", [1, 2, 3])
await net.run_until_blocked()
for epoch_id in net.get_startable_epochs():
await net.execute_epoch(epoch_id)
results = net.flush_output_queue("results")
print(results)
asyncio.run(main())
Documentation
- CLAUDE.md — Full module documentation and API reference
- PROJECT_SPEC.md — Detailed project specification
- NBLITE_INSTRUCTIONS.md — How to write code (nblite workflow)
Development
This project uses nblite for literate programming. Source code lives in .pct.py files under pts/, not in src/ (which is auto-generated).
# Edit source
vim pts/netrun/06_net/01_net/02_net.pct.py
# Export changes
nbl export --reverse && nbl export
# Run tests
uv run pytest src/tests/ -v
# Run specific tests
uv run pytest src/tests/net/ -v
uv run pytest src/tests/pool/test_thread.py -v
Never edit files in src/ directly — they are auto-generated from pts/.
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 netrun-0.5.0.tar.gz.
File metadata
- Download URL: netrun-0.5.0.tar.gz
- Upload date:
- Size: 776.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
385a415723fd2a59ba0d13a05a084be48013b9bb80a1092a4e692a818e13556d
|
|
| MD5 |
25250296a4d1d0a9d7ae705b73c55a03
|
|
| BLAKE2b-256 |
2b5cf4545546e792428b9f82e94594f85525b404c16b151ea99ddc14d26fb87e
|
Provenance
The following attestation bundles were made for netrun-0.5.0.tar.gz:
Publisher:
release.yml on lukastk/netrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netrun-0.5.0.tar.gz -
Subject digest:
385a415723fd2a59ba0d13a05a084be48013b9bb80a1092a4e692a818e13556d - Sigstore transparency entry: 1199750914
- Sigstore integration time:
-
Permalink:
lukastk/netrun@20dcaf17ae513418a057bd70813635218a49017c -
Branch / Tag:
refs/tags/netrun-v0.5.0 - Owner: https://github.com/lukastk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@20dcaf17ae513418a057bd70813635218a49017c -
Trigger Event:
push
-
Statement type:
File details
Details for the file netrun-0.5.0-py3-none-any.whl.
File metadata
- Download URL: netrun-0.5.0-py3-none-any.whl
- Upload date:
- Size: 182.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
529e8bfb3e842731d59aa7a976e51a99f75f2c484433c9a970a117d4900b1660
|
|
| MD5 |
45a8265bb7b4214587163dc5dd1227a5
|
|
| BLAKE2b-256 |
9bc0917053ffd46dfd14525e3909e901b411ac911fa04a03fd6658b0ed51d865
|
Provenance
The following attestation bundles were made for netrun-0.5.0-py3-none-any.whl:
Publisher:
release.yml on lukastk/netrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netrun-0.5.0-py3-none-any.whl -
Subject digest:
529e8bfb3e842731d59aa7a976e51a99f75f2c484433c9a970a117d4900b1660 - Sigstore transparency entry: 1199750923
- Sigstore integration time:
-
Permalink:
lukastk/netrun@20dcaf17ae513418a057bd70813635218a49017c -
Branch / Tag:
refs/tags/netrun-v0.5.0 - Owner: https://github.com/lukastk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@20dcaf17ae513418a057bd70813635218a49017c -
Trigger Event:
push
-
Statement type: