Skip to main content
Python reaches WebAssembly through componentize-py, which bundles the interpreter and your module into a single WASI Preview 2 component.

Prerequisites

  • Python 3.10 or newer.
  • uv for dependency management.
  • The Noorle CLI.
  • The shared WebAssembly tools, installed once with noorle plugin prepare.

Layout

The interface

The Python world imports the WASI interfaces it needs explicitly — outbound HTTP and the environment — and exports one function.
This example returns a JSON string rather than a WIT record, which keeps the Python side to plain dictionaries.

The implementation

The build generates a wit_world package from your WIT. You subclass the generated class and implement the exported function as a method.
Outbound HTTP uses the generated WASI bindings directly. requests and other socket-based clients do not work inside the component — the sandbox exposes WASI HTTP and no raw sockets.
Environment variables come from wasi:cli/environment, and only the keys listed under permissions.environment are visible.

pyproject.toml

Pure-Python dependencies can be added here. Anything with a compiled extension will not build for the WASI target.

noorle.yaml

Same shape in every language. Full key-by-key reference: noorle.yaml.

Build

That runs the project’s build.sh, which syncs dependencies, fetches the WIT dependencies, generates bindings, and then componentizes:
The bindings step writes the wit_world package your code imports; the componentize step takes the module name (app) and emits the component.

Test locally

Deploy

Next