Skip to main content

lm-flow

English | 简体中文

A dataflow-graph engine: computation is described as a directed graph — nodes are kernels, and timestamped packets flow along the edges. The engine is written in Rust (scheduling, threads, queues, topology) and exposes a single stable C ABI; kernels can be written in C++ or Python.

  Host (Rust / C++ / Python) ── drives the graph
        │  C ABI  (lmflow/include/flow.h)
        ▼
  Engine (Rust): scheduler · executors · edge queues · topology · YAML
        │  C ABI  (callbacks)
        ▼
  Kernels: C++ (flow.hpp sugar)  /  Python

Layout

First-party source lives under lmflow/; build files and the vendored submodule sit at the repo root (which is also the Python project root, so wheels bundle everything they need).

lm-flow/
├── lmflow/                    All first-party source
│   ├── flow-core/             Engine — standalone Rust crate (lib + staticlib + cdylib)
│   │   ├── build.rs           Compiles ../cpp via `cc` and links it in
│   │   ├── Cargo.toml · Cargo.lock
│   │   ├── src/ · tests/ (ABI layout consistency) · examples/ (Rust hosts)
│   ├── include/               Public headers (authoritative C ABI + optional C++ sugar)
│   │   ├── flow.h             C ABI — the only stable interface
│   │   └── flow.hpp           C++ kernel sugar (header-only, not ABI)
│   ├── cpp/                    C++ kernels
│   │   ├── kernels/            Built-in sample kernels (11, one file per kernel + register.cc)
│   │   ├── abi_assert.cc       Compile-time checks of the cross-boundary struct layout
│   │   └── tests/              C++ test executables (flow.hpp unit test, CV conversion test)
│   ├── python/                pybind11 bindings (src/) + the lmflow package + CMakeLists
│   └── examples/              each example is self-contained: examples/<lang>/<name>/
│       ├── cpp/hello_world/    standalone C++ project (find_package or build-from-source)
│       ├── python/             hello_world/, realtime_pipeline/, opencv_pipeline/
│       └── {android,ios,harmonyos}/hello_world/   mobile integration examples
├── third_party/pybind11/      vendored git submodule (only used to build the Python wheel)
├── cmake/                     engine.cmake · install-sdk.cmake · find_package config
├── docs/design.md             Design document (authoritative)
├── CMakeLists.txt             Top-level build (drives cargo; C/C++ SDK + Python extension)
└── pyproject.toml             Python wheel (scikit-build-core → the same CMake)

Core concepts

Concept Description
Graph A computation graph described in YAML; handles init, start, input-close and termination
Node A node in the graph, holding one kernel instance
Kernel User-written compute logic implementing Open/Process/Close
Edge/Port Edges and ports connect producers to consumers by name; an edge carries a queue of timestamped packets
Packet A packet = an immutable shared payload + a timestamp
Contract Port type contract, declared by the kernel in GetContract
Poller/Observer Two ways to take graph output: pull (blocking/timeout/non-blocking) and push (callback)

Quick start

The engine is a standalone Rust crate under lmflow/flow-core (Rust developers work there directly):

cd lmflow/flow-core
cargo build                       # build the engine + C++ kernels
cargo test                        # unit tests + ABI layout consistency
cargo run --example hello_world   # two-stage passthrough pipeline, prints 0..9

Python:

pip install lm-lmflow               # prebuilt wheels (Linux manylinux / macOS)
import lmflow

lmflow.register_builtin_kernels()

@lmflow.kernel("Double")
class Double(lmflow.Kernel):
    def process(self, cc):
        cc.emit(0, cc.input(0).as_int() * 2)

g = lmflow.Graph.from_yaml("""
nodes:
  - { name: d, kernel: Double, input_ports: [in], output_ports: [out] }
input_ports: [in]
output_ports: [out]
""")
out = g.add_poller("out")
g.start()
g.input("in").send(21, ts=0)
print(out.next(timeout=5.0).as_int())   # 42
g.close_all_inputs(); g.wait_done(timeout=5.0)

Only prebuilt wheels are published — if no wheel matches your platform, pip install fails rather than compiling on your machine. To build locally instead, clone with submodules and build the wheel from source (needs a Rust toolchain + CMake):

git clone --recursive https://github.com/laomou/lm-flow
pip install ./lm-flow          # scikit-build-core drives CMake → cargo + pybind11

A kernel looks like this (C++, using the sugar layer):

class PassThroughKernel : public lmflow::Kernel {
 public:
  static void GetContract(lmflow::Contract& c) { c.InputSetAny(0); c.OutputSetAny(0); }
  lmflow::Status Process(lmflow::Context& cc) override {
    cc.Forward(0, 0);                      // zero-copy passthrough
    return lmflow::Status::Ok();
  }
};

A graph looks like this (YAML):

nodes:
  - name: "scale"
    kernel: "ScaleKernel"
    input_ports: ["in"]
    output_ports: ["out"]
    options: { factor: 3 }
input_ports: ["in"]
output_ports: ["out"]

See docs/design.md for the full design.

Native SDK (C / C++ / mobile)

C/C++ and mobile hosts don't use pip — they use the headers + library directly. Each tagged GitHub Release ships per-platform lmflow-<version>-<platform>.tar.gz (Linux x86_64/aarch64, macOS arm64, iOS arm64, Android arm64):

lmflow-v0.1.0-linux-x86_64/
├── include/   flow.h · flow.hpp · flow_cv.hpp · flow_platform_log.hpp
└── lib/       libflow_core.a (static, self-contained, preferred) · libflow_core.so (shared)
# Link the static library (recommended, especially for mobile embedding):
g++ -std=c++17 -Iinclude my_host.cc lib/libflow_core.a -lpthread -ldl -lm -o my_host

Or build one yourself locally:

cd lmflow/flow-core
cargo build --release          # → lmflow/flow-core/target/release/libflow_core.{a,so}
# the headers are the three under lmflow/include

Build & consume with CMake

CMake is the top-level build for the C++/native side; it lives at the repo root and drives cargo (which builds the Rust engine + C++ kernels into libflow_core), builds the C++ examples/tests, and installs a find_package config:

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build                       # flow.hpp test; CV test if OpenCV is present
cmake --install build --prefix /opt/lmflow   # → headers + lib + lib/cmake/lmflow

Consumers then just:

find_package(lmflow REQUIRED)
target_link_libraries(my_app PRIVATE lmflow::flow_core)   # headers + libflow_core.a + system libs

Rust developers use cargo in lmflow/flow-core; Python users just pip install lm-lmflow (prebuilt wheels). The wheel is built by scikit-build-core driving this same root CMake (-DLMFLOW_BUILD_PYTHON=ON), so there is one build definition, not three.

The C ABI is the only stable interface (lmflow/include/flow.h); flow.hpp is the optional C++ kernel sugar, flow_cv.hpp is OpenCV interop, and flow_platform_log.hpp bridges engine logs to the platform logger (logcat / os_log / HiLog) in one call — lmflow::InstallPlatformLogSink().

Mobile integration examples: lmflow/examples/android/hello_world (JNI), lmflow/examples/ios/hello_world (Swift), lmflow/examples/harmonyos/hello_world (NAPI).

Metadata

Release files for lm-lmflow 0.1.0

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

Built distributions (wheels)

Table of built distributions (wheels) for lm-lmflow 0.1.0
File
lm_lmflow-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
lm_lmflow-0.1.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
lm_lmflow-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
lm_lmflow-0.1.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
lm_lmflow-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
lm_lmflow-0.1.0-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
lm_lmflow-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64 Details
lm_lmflow-0.1.0-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details

Total release size: 8.2 MB

Release files / lm_lmflow-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL lm_lmflow-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f94cb6533f86df716fd2bfb5521eadb59725ba0d26c94be8cc4d226d9586a79f
BLAKE2b-256 checksum
How to use checksums
f199135630384b00c2cf6242aba061bdb43992e68d59fbd619b9332c1c444f18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 2, 2026.

Transparency log

Release files / lm_lmflow-0.1.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL lm_lmflow-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Size 956.5 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1f580cea5a7ab2fdc6e2a7b9e905e6fc671aafc64f8a7e1b6e82dcaa8d2015fa
BLAKE2b-256 checksum
How to use checksums
745d5d637e92827982f3e50d72f94df4444ed946a1a25c0980f770b9640573a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 2, 2026.

Transparency log

Release files / lm_lmflow-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL lm_lmflow-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
224b9298c6b58c5274772472a99bb654f915d65b273a2d90b49238efff69fc35
BLAKE2b-256 checksum
How to use checksums
ac27d3651e5580b38b7cc72864b0960af1b44eb0ad8d5161e4a97d8697a72761
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 2, 2026.

Transparency log

Release files / lm_lmflow-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL lm_lmflow-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Size 956.2 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2672f5c696685c982529b949f27204e66d7654c4c13a779741242b60becf4fa3
BLAKE2b-256 checksum
How to use checksums
40cba1f27700daeb0261db57af0afa9a0caa2370867d3859708ddc1d6b8ca95f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 2, 2026.

Transparency log

Release files / lm_lmflow-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL lm_lmflow-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
355df1ce7a4daa06048e27ae179b7feaa5bf55d0c3bd65ed1ce6dbaa77c2d28e
BLAKE2b-256 checksum
How to use checksums
b1dd9665293b17eae436d7a7bfa21f70460ff44b91bda51ce506b2b6a9446e7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 2, 2026.

Transparency log

Release files / lm_lmflow-0.1.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL lm_lmflow-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Size 956.1 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b3fa84119e8584b482089066c67ee2e10eee47447f99043383a39a5c440da14f
BLAKE2b-256 checksum
How to use checksums
14d5747a5ea50cdac6ce167e72e275c7fa91a9b51f379b40d1eb8f5979168d15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 2, 2026.

Transparency log

Release files / lm_lmflow-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl

Download URL lm_lmflow-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ae80cb9eda6a2a8a9244b6f4e1a01a9c9d244bf5414a832254875b77a259c94d
BLAKE2b-256 checksum
How to use checksums
a2ae3b51a2646d8aab8451cbd178c03c1984d22ce452496c3f29a59efaae1764
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 2, 2026.

Transparency log

Release files / lm_lmflow-0.1.0-cp39-cp39-macosx_11_0_arm64.whl

Download URL lm_lmflow-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Size 956.2 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5def07d311f61b3b9b0496048ef999ff2bb9d2b10a6cd489c048cb63e08cf549
BLAKE2b-256 checksum
How to use checksums
48d2fde58113262794dbb5d7a1060af31a4fd561b37edcbe7563ddbefd506521
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.3

9 release files

0.3.2

8 release files

0.3.1

8 release files

0.3.0

8 release files

0.2.0

8 release files

0.1.1

8 release files

This release

0.1.0 This release

8 release files

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