Python WASM Nodes
Flow-Like’s Python SDK builds ordinary Python node logic into a WASM Component
with componentize-py. Python support is available now; it does not use
Pyodide, RustPython, or MicroPython.
Start from the template
Section titled “Start from the template”Copy templates/wasm-node-python, then run:
mise run setupmise run testmise run buildThe template uses Python 3.12, uv, the published
flow-like-wasm-sdk package, and componentize-py. The component is written to:
build/node.wasmWithout mise, the equivalent commands are:
uv sync --group dev --group builduv run pytest -vuv run python build.pyDefine a node
Section titled “Define a node”The recommended declarative API derives pins from Python annotations:
from flow_like_wasm_sdk import ( Exec, ExecInput, ExecOutput, ExecutionResult, Input, Output, WasmNode,)
class Uppercase( WasmNode, name="uppercase_py", title="Uppercase", category="Custom/Text",): """Converts text to uppercase."""
trigger: Exec = ExecInput(description="Trigger execution") text: str = Input(default="", description="Text to transform") done: Exec = ExecOutput(description="Continue execution") result: str = Output(description="Uppercase text")
def run(self, ctx) -> ExecutionResult: ctx.result = (ctx.text or "").upper() ctx.activate_exec("done") return ctx.success()Defining a concrete WasmNode subclass registers it automatically. The
template’s app.py exposes every registered class through the WIT
get-nodes and run exports.
Use stable name and pin identifiers. They become part of persisted board
interfaces.
Pin types
Section titled “Pin types”The declarative API maps common annotations automatically:
| Python annotation | Flow-Like pin |
|---|---|
str | String |
int | 64-bit integer |
float | 64-bit float |
bool | Boolean |
bytes | Bytes |
Exec with ExecInput/ExecOutput | Execution |
Pydantic models and SDK interop types such as FlowPath become struct pins.
Lists, dictionaries, and sets are supported as collection value types.
Permissions
Section titled “Permissions”Declare capability labels on the class:
class FetchText( WasmNode, name="fetch_text_py", title="Fetch Text", category="Custom/Network",): permissions = ["network:http", "streaming"]Permissions are exported with that node and used by the runtime sandbox. Common
labels include network:http, storage:read, storage:write, variables,
cache, streaming, models, a2ui, oauth, and functions.
Package memory and timeout limits belong in flow-like.toml. See the
manifest reference.
Host services
Section titled “Host services”The context exposes gated host services for logging, streaming, variables, cache, storage, HTTP, OAuth, and models. For example:
ctx.info("Calling upstream API")response = ctx.http_get("https://api.example.com/data")ctx.stream_progress(0.5, "Halfway")The node must declare the matching permission before using a gated service.
Python packages that depend on native extensions or unavailable WASI features may not componentize successfully. Test dependencies in the template rather than assuming all PyPI packages are portable to WASM.
Test and inspect
Section titled “Test and inspect”Unit tests execute the node classes natively with the SDK’s mock host bridge:
mise run testTo inspect definitions without compiling a component:
mise run build-definitionThat command writes a JSON definition under build/. It is useful for checking
names, pins, and permissions in review.
Publish
Section titled “Publish”- Run
mise run build. - Open Flow-Like Desktop.
- Go to Library → Packages → Publish.
- Select
build/node.wasmandflow-like.toml. - Review the nodes extracted from the binary and submit.