wasmfunc is a Python to WebAssembly Compiler built for converting a typed subset of python code to a compiled Wasm binary.
pip install wasmfuncAnnotate your python function with Wasm types
# fib.py@wasmfunc()deffib_recursive(n: i32) ->i32:
ifn<=1:
returnnelse:
returnfib_recursive(n-1) +fib_recursive(n-2)Then compile with
wasmfunc compile fib.py
# Or python -m wasmfunc compile fib.pyFor more examples see examples.