y-crdt/ypy

Build `emscripten` wheels

kafonek opened this issue · 1 comments

I want to micropip.install('y-py') in a Pyodide script and use the same syntax in Pyodide as I do with server-side Python. I understand I could just plug into the yjs library itself through Pyodide's js interface, but I would prefer the consistent syntax and ability to prototype/test in Python server side.

I've put together https://github.com/kafonek/py-rust-fib as a reference while learning how y-crdt and ypy work together, starting at zero with Rust. It's been a fun experience, changes some of my perspectives on parts of the Python ecosystem.

Following this section in py-rust-fib, I tried using emsdk version 3.1.14 (matching emscripten version for Pyodide 0.21.3) to build an emscripten wheel. Loading it into Pyodide failed on the first try because maturin does not have a pure Python wheel, but when I moved that into an optional dependency in the hatch branch, I was also able to import y_py into a Pyodide worker!

image

(js.console.log(y_py.YDoc()))
image

I'll work on a PR if building emscripten wheels sounds good to you all.

That sounds awesome @kafonek !
cc @DerThorsten who might be able to help.