- Major runtimes - wasmtime / wasmcloud / wasmer - Runtime Comparison
- Others to check - fermyon spin / wamr / wasmedge / wazero
Python example
print("Hello, world!")
- Other languages : Golang / rust (pending)
For python, pip install componentize-py
- Below is simple WIT / Interface (
hello.wit
) that would print some string whenhello
function is called
package example:hello;
world hello {
export hello: func() -> string;
}
- To understand the internal bindings, you can always run below; (Optional)
componentize-py -d hello.wit -w hello bindings .
- Write the app that would print Hello, World!
import hello
class Hello(hello.Hello):
def hello(self) -> str:
return "Hello, World!"
- Generate the component
componentize-py -d hello.wit -w hello componentize app -o app.wasm
wasmtime run only knows how to run components targeting the wasi-cli world. It does not (as of this writing) know how to run components targeting arbitrary worlds like the hello world
Follow this
**Right now, You can create component in python and import it in another host application written in python. **
Implement host application in other languages - Rust, Golang, Python