This example demonstrates building and running a simple WASM component in Python using Tarawasm.
-
Initialize Extract WIT definitions and save project config:
tarawasm init --lang python --wasm-file docs:adder@0.1.0.wasm adder
-
Generate bindings
tarawasm bind -
Write your code Create
main.pyin the project root:from adder import exports class Run(exports.Run): def run(self) -> None: print("Hello from Python WASM!")
-
Build
tarawasm build
This produces
adder.wasmin the current directory. -
Run Use any WASM runtime, e.g. Wasmtime:
wasmtime adder.wasm # Output: Hello from Python WASM!