Stream: wasi

Topic: ✔ pyo3 for wasi?


view this post on Zulip Ramon Klass (Jul 03 2023 at 11:49):

Hi, I'm not sure if anyone tried this yet, but I was thinking if it is possible to use pyo3 in a component, I would like to run a Rust program that calls into a python library when needed

since Google doesn't help I'm pretty sure there is no well-traveled path but has anyone looked into this yet?

view this post on Zulip Joel Dice (Jul 03 2023 at 13:40):

You might want to look at componentize-py and/or spin-python-sdk, both of which use Py03 to bridge Rust and Python in a WASI guest. The key to making it work is building CPython to target WASI and setting the lib_dir option in your Py03 config file to point to it, e.g. https://github.com/dicej/componentize-py/blob/7f7489dcae8104f501902854a901394c8a17c4c3/build.rs#L222-L248.

Contribute to dicej/componentize-py development by creating an account on GitHub.
Experimental Spin Python SDK. Contribute to fermyon/spin-python-sdk development by creating an account on GitHub.
Contribute to dicej/componentize-py development by creating an account on GitHub.

view this post on Zulip Ramon Klass (Jul 03 2023 at 14:44):

oh I didn't realize componentize actually uses pyo3, thank you I will have a deeper look :)

side question, is there any update on supporting the new wit format with packages?

view this post on Zulip Joel Dice (Jul 03 2023 at 15:31):

The snapshot branch in the componentize-py repo uses the new WIT format, but that branch also includes native extension support (i.e. the "pseudo-dynamic linking" stuff I mentioned above), which depends on toolchain changes which haven't been upstreamed yet. I'm hoping to work on that later this week. The WIT-related changes could probably be backported to the main branch, but I'm not sure that's worth the effort.

view this post on Zulip Ramon Klass (Jul 03 2023 at 15:53):

I agree backporting is too much effort, thanks a lot for the progress report :) I hope upstream merges will go smoothly

view this post on Zulip Notification Bot (Jul 03 2023 at 16:14):

Ramon Klass has marked this topic as resolved.

view this post on Zulip Robin Brown (Jul 10 2023 at 19:34):

@Ramon Klass if you're interested in keeping up with the progress on Python. @Joel Dice and @Kevin Smith are the organizers of the Python Subgroup of the Guest Languages SIG and they meet as a group on an every other week cadence to talk about Python guest work.

view this post on Zulip Ramon Klass (Jul 11 2023 at 14:55):

I'm generally interested, I wasn't sure how open those meetings are and never dared to sign up for one

view this post on Zulip Ralph (Jul 11 2023 at 16:53):

no harm in dropping in to find out!

view this post on Zulip Jamey Sharp (Jul 11 2023 at 19:09):

I'd love to see more interested folks show up!

view this post on Zulip Robin Brown (Jul 11 2023 at 19:28):

All meetings for SIG Guest Languages and its subgroups are fully open to the public. You're welcome to join us!


Last updated: Nov 22 2024 at 16:03 UTC