bytecodealliance / componentize-py

Apache License 2.0
136 stars 13 forks source link

refactor, update deps, and add native extension support #4

Closed dicej closed 1 year ago

dicej commented 1 year ago

This includes a major refactor of the project to enable native extension support via shared-everything dynamic linking. In particular, the old process (edit the runtime Wasm file to inject the application code, run the result through Wizer, and use wit-component to make the component) has been replaced by a new process:

  1. Synthesize an adapter module which does the canonical ABI lifting and lowering.
  2. Link the adapter module with the runtime library, libpython3.11.so, libc.so, any native extension libraries, and a few other libraries, producing a component.
  3. Pre-initialize the component using component-init.

This currently requires temporary forks of wasi-sdk and CPython, plus a nightly Rust release, but I expect we'll be able to use stable, official releases of those projects once everything has been upstreamed.