Hua has marked this topic as resolved.
Joel Dice 說:
Here's a quick example of building two components using
componentize-py, composing them, and running the result:mkdir compose cd compose python3 -m venv .venv source .venv/bin/activate pip install componentize-py cat >worlds.wit <<EOF package test:test; interface foo { bar: func() -> string; } world thing1 { export foo; } world thing2 { import foo; export run: func() -> string; } EOF cat >mything1.py <<EOF from wit_world import exports class Foo(exports.Foo): def bar(self) -> string: return "Hello, world!" EOF cat >mything2.py <<EOF import wit_world from wit_world.imports import foo class WitWorld(wit_world.WitWorld): def run(self) -> string: return foo.bar() EOF componentize-py -d worlds.wit -w thing1 componentize mything1 -o thing1.wasm componentize-py -d worlds.wit -w thing2 componentize mything2 -o thing2.wasm wasm-tools compose -d thing1.wasm thing2.wasm -o composed.wasm wasmtime run --invoke 'run()' composed.wasm
Thank you for your response. I got it.
Last updated: Jan 09 2026 at 13:15 UTC