-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build platform independent rust binary wheel through wasi #1107
Conversation
✅ Deploy Preview for maturin-guide ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea!
# TODO: this is taken from https://docs.wasmtime.dev/api/wasmtime/struct.Linker.html#method.get_default | ||
# is this always correct? | ||
start = linking1.exports(store).get("") or linking1.exports(store)["_start"] | ||
start(store) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember that wasmtime execution is sandboxed, so you might need to give access to file systems explicitly somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think so, let's see if i get a response in bytecodealliance/wasmtime-py#94 and otherwise i'll have to collect some real world use cases compatible with wasm
|
yet that's the next step |
This comment was marked as outdated.
This comment was marked as outdated.
We build the rust binaries to wasi and put them in a wheel with a wasmtime launcher. The resulting wheels are platform independent (py3-none-any) and run on all wasmtime platforms. Those are currently less than maturin natively, but you still only have to build one wheel and i hope for some nice things in the future (isolation capabilities, wasm runtimes on less-supported platforms)
ready to merge from my end |
https://build.opensuse.org/request/show/1036879 by user mia + dimstar_suse - Update to v0.14.0: * Breaking Change: Remove support for specifying python package metadata in `Cargo.toml` Python package metadata should be specified in the `project` section of `pyproject.toml` instead as PEP 621 specifies. gh#PyO3/maturin#1200 * Initial support for shipping bin targets as wasm32-wasi binaries that are run through wasmtime Note that wasmtime currently only support the five most popular platforms and that wasi binaries have restrictions when interacting with the host. Usage is by setting `--target wasm32-wasi`. gh#PyO3/maturin#1107 * Add support for python first `src` project layout gh#PyO3/maturin#1185 * Add `--src` option to generate src layout for mixed Python/Rust projects gh#PyO3/maturin#1189 * Add Python metadata support for `license-file
I had this idea that besides having to build a wheel for each platform and then still there are platforms without manylinux supports, we could have a single wasm wheel as a generic fallback. Currently more theoretical since wasmtime supports less platforms than manylinux. Also we could have isolation and such in the future.
We build the rust binaries to wasi and put them in a wheel with a wasmtime launcher. The resulting wheels are platform independent (py3-none-any) and run on all wasmtime platforms.
TODO: