Skip to content
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

Pure Python wheel or WASM/Emscripten build #423

Open
psychemedia opened this issue Dec 16, 2024 · 7 comments
Open

Pure Python wheel or WASM/Emscripten build #423

psychemedia opened this issue Dec 16, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@psychemedia
Copy link

I would like to be able to use rapidfuzz in WASM / Pyodide backed notebook environments such as JupyetrLite and marimo notebooks.

Is there any chance of getting a pure Python wheel for rapidfuzz, or a WASM/Emscripten compiled wheel?

@psychemedia psychemedia changed the title Pure Pyhton wheel or WASM/Emscripten build Pure Python wheel or WASM/Emscripten build Dec 16, 2024
@maxbachmann maxbachmann added the enhancement New feature or request label Dec 16, 2024
@maxbachmann
Copy link
Member

maxbachmann commented Dec 16, 2024

Yes I could build both pure python wheels and wasm compiled wheels. The pure Python wheels are much smaller (somewhere around 60kb vs 777kb). However the compiled wheel should be faster (I didn't test that though).

So I think it would likely make sense to publish both versions so users can select based on their usage.
How are wheels for pyodide usually published?

@psychemedia
Copy link
Author

psychemedia commented Dec 17, 2024

In pyodide, if the PyPi wheels are universal, they can be installed using micropip. I think distribution of wasm32-emscripten wheels is still a niche thing, although cibuildwheel has supported the wasm32 target for some time.

As to getting packages into pyodide, I think that is managed by requesting inclusion via an issue to the pyodide repo.

@maxbachmann
Copy link
Member

I published a new version that properly builds for pyodide. There are already requests to add it to pyodide (pyodide/pyodide#4994) and emscripten-forge (emscripten-forge/recipes#1270). So hopefully it will get added there soon.

In the meantime you can use the attached wheel and just host it yourself.

pyodide-wheel.zip

@psychemedia
Copy link
Author

Fantastic, thanks.

@psychemedia
Copy link
Author

From a quick upload test to JupyterLite, neither the zip nor the wheel can be imported using micropip.install(). I'm not sure if this is a wheel name convention thing or something other.

@psychemedia psychemedia reopened this Dec 17, 2024
@maxbachmann
Copy link
Member

I don't know much about the pyodide ecosystem. I used the attached test environment. There I did run:

  • python cors_server.py to make the wheel available with a working access control
  • opened the index.html in a browser

This did work for me:
image

testEnv.zip

@agriyakhetarpal
Copy link

From a quick upload test to JupyterLite, neither the zip nor the wheel can be imported using micropip.install(). I'm not sure if this is a wheel name convention thing or something other.

This was probably because we changed the ABI tag from emscripten_X_Y_ZW to pyodide_YYYY_N. Linked issue: pyodide/micropip#158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants