Skip to main content

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netrun-0.5.0.tar.gz (776.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netrun-0.5.0-py3-none-any.whl (182.1 kB view details)

Uploaded Python 3

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

Hashes for netrun-0.5.0.tar.gz
Algorithm Hash digest
SHA256 385a415723fd2a59ba0d13a05a084be48013b9bb80a1092a4e692a818e13556d
MD5 25250296a4d1d0a9d7ae705b73c55a03
BLAKE2b-256 2b5cf4545546e792428b9f82e94594f85525b404c16b151ea99ddc14d26fb87e

See more details on using hashes here.

Provenance

The following attestation bundles were made for netrun-0.5.0.tar.gz:

Publisher: release.yml on lukastk/netrun

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for netrun-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 529e8bfb3e842731d59aa7a976e51a99f75f2c484433c9a970a117d4900b1660
MD5 45a8265bb7b4214587163dc5dd1227a5
BLAKE2b-256 9bc0917053ffd46dfd14525e3909e901b411ac911fa04a03fd6658b0ed51d865

See more details on using hashes here.

Provenance

The following attestation bundles were made for netrun-0.5.0-py3-none-any.whl:

Publisher: release.yml on lukastk/netrun

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page