40 lines
1.1 KiB
Markdown
40 lines
1.1 KiB
Markdown
# KPN++
|
|
|
|
A C++20 [Kahn Process Network](https://en.wikipedia.org/wiki/Kahn_process_networks) library. Each node wraps a plain function and runs concurrently, communicating with downstream nodes via bounded FIFO channels. Includes Python bindings via nanobind.
|
|
|
|
---
|
|
|
|
## Why KPN++?
|
|
|
|
- **Zero boilerplate** — wrap any callable as a node; types flow automatically from the function signature
|
|
- **Bounded channels** — backpressure is structural, not bolted on
|
|
- **Observable** — per-node and network-level callbacks for overflow and stop events; diagnostics snapshots; optional web UI
|
|
- **Composable** — `Network` for runtime wiring, `StaticNetwork` for compile-time topology with zero overhead
|
|
|
|
---
|
|
|
|
## Quick example
|
|
|
|
```cpp
|
|
#include <kpn/kpn.hpp>
|
|
using namespace kpn;
|
|
|
|
--8<-- "examples/01_hello_pipeline/main.cpp:basic_node_fns"
|
|
|
|
int main() {
|
|
--8<-- "examples/01_hello_pipeline/main.cpp:network_build"
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Install & build
|
|
|
|
```bash
|
|
cmake -B build
|
|
cmake --build build --parallel
|
|
ctest --test-dir build # unit tests + example smoke tests
|
|
```
|
|
|
|
See [Getting Started](getting-started.md) for full build options.
|