Skip to main content

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 (function factory) or fan-out patterns (broadcast factory)
  • 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

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/.

Metadata

Release files for netrun 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netrun 0.5.0
File Size Uploaded Provenance Actions
netrun-0.5.0.tar.gz 776.5 kB With provenance Details for netrun-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for netrun 0.5.0
File Interpreter ABI Platform Actions
netrun-0.5.0-py3-none-any.whl Python 3 none any Details for netrun-0.5.0-py3-none-any.whl

Total release size: 958.6 kB

Release files / netrun-0.5.0.tar.gz

Download URL netrun-0.5.0.tar.gz
Size 776.5 kB
Tags Source
SHA-256 checksum
How to use checksums
385a415723fd2a59ba0d13a05a084be48013b9bb80a1092a4e692a818e13556d
BLAKE2b-256 checksum
How to use checksums
2b5cf4545546e792428b9f82e94594f85525b404c16b151ea99ddc14d26fb87e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 30, 2026.

Transparency log

Release files / netrun-0.5.0-py3-none-any.whl

Download URL netrun-0.5.0-py3-none-any.whl
Size 182.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
529e8bfb3e842731d59aa7a976e51a99f75f2c484433c9a970a117d4900b1660
BLAKE2b-256 checksum
How to use checksums
9bc0917053ffd46dfd14525e3909e901b411ac911fa04a03fd6658b0ed51d865
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 30, 2026.

Transparency log

Security for netrun 0.5.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for netrun-0.5.0.tar.gz

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 Mar 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page