#define KPN_BUILD_PYTHON #include #include namespace nb = nanobind; using namespace kpn; using namespace kpn::python; // ── Demo node functions (hello-pipeline) ────────────────────────────────────── static int produce() { return 42; } static int double_it(int x) { return x * 2; } static void print_it(int x) { std::cout << "result: " << x << '\n'; } // ── Registry ────────────────────────────────────────────────────────────────── // Variant type is auto-deduced as std::variant from the port types above. using DemoNodes = NodeRegistry< Entry, Entry, Entry >; // ── Module ──────────────────────────────────────────────────────────────────── NB_MODULE(kpn_python, m) { m.doc() = "KPN++ Python bindings — Kahn Process Network library"; // Registers: Network, INode, ProduceNode, DoubleItNode, PrintItNode, // make_produce(), make_double_it(), make_print_it() bind_network(m); // Also expose raw functions for direct testing (no network needed): // kpn.produce() → 42 // kpn.double_it(5) → 10 // kpn.print_it(84) → prints "result: 84", returns None bind_debug(m); }