You can build libraries today, but most non-JS runtimes wouldn’t be able to run them today.
Having said that, you can run the task
compileProductionExecutableKotlinWasmWasi
and see the output in
build
(Gradle plugin support for WASI is a bit rough, and there could be a better way that I don’t know of)
build
└── compileSync
└── wasmWasi
└── main
└── productionExecutable
└── kotlin
├── kotlin-wasm-wasi-example-wasm-wasi.map
├── kotlin-wasm-wasi-example-wasm-wasi.mjs
└── kotlin-wasm-wasi-example-wasm-wasi.wasm
The
kotlin-wasm-wasi-example-wasm-wasi.wasm
is the file you are looking for. You can, in theory, use it independently with any wasm runtime that supports recent additions like WasmGC. In practice, these runtimes are V8 and SpiderMonkey, and your python embedding probably wouldn’t support it yet.