3 ms·
I've been looking forward to this for ages! This means we can now take any C/Rust/whatever extension for Python, compile that as a `.wasm` extension, and then
by simonw 5mo ago
I've been looking forward to this for ages!
This means we can now take any C/Rust/whatever extension for Python, compile that as a `.wasm` extension, and then load it directly in browser Pyodide projects using:
await micropip.install("package-on-pypi")
import package_name
Here's how to try the new feature out. Visit https://pyodide.org/en/stable/console.html https://pyodide.org/en/stable/console.html and type:
import micropip
await micropip.install("pydantic_core")
import pydantic_core
That gets you this WASM wheel: https://pypi.org/project/pydantic_core/#pydantic_core-2.47.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl https://pypi.org/project/pydantic_core/#pydantic_core-2.47.0...
You can tell that it's got compiled code in (and not just Python) by running:
pydantic_core._pydantic_core
I get this:
<module 'pydantic_core._pydantic_core' from '/lib/python3.14/site-packages/pydantic_core/_pydantic_core.cpython-314-wasm32-emscripten.so'>
- simonw 5mo agoI had an older experimental Pyodide WASM project lying around (a packaging of the Luau language by Roblox) so I had Codex package that up for me and pushed it to PyPI. Here's the package: https://pypi.org/project/luau-wasm/ https://pypi.org/project/luau-wasm/ import micropip await micropip.install("luau-wasm") import luau_wasm print(luau_wasm.execute(r''' local animals = {"fox", "owl", "frog", "rabbit"} table.sort(animals, function(a, b) return #a < #b end) for i, name in animals do print(i .. ". " .. name .. " (" .. #name .. ")") end ''')) And an interactive demo page where you can try it out: https://simonw.github.io/luau-wasm/ https://simonw.github.io/luau-wasm/ Wrote about this in more detail on my blog: https://simonwillison.net/2026/Jun/13/publishing-wasm-wheels/ https://simonwillison.net/2026/Jun/13/publishing-wasm-wheels...
- deleted 5mo ago[deleted]
- willXare 5mo ago[flagged]
- rtpg 5mo agoIs there any form of client-side caching that kicks in with all of this flow? Tbh I don't feel great about people just writing up a bunch of scripts pulling things just on every run.
- simonw 5mo agoBrowser caching works with stuff pulled from PyPI, so it shouldn't get loaded more than once.
- westurner 5mo agoHere are all of the existing emscripten-forge recipes for building WASM packages: https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten https://github.com/emscripten-forge/recipes/tree/main/recipe... From https://news.ycombinator.com/item?id=43201706 https://news.ycombinator.com/item?id=43201706 : > jupyterlite-xeus supports environment.yml with jupyterlite with packages from emscripten-forge: https://jupyterlite-xeus.readthedocs.io/en/latest/environment.html https://jupyterlite-xeus.readthedocs.io/en/latest/environmen... emscripten-forge was a Quetz repo built with but is now hosted on prefix.dev. From https://emscripten-forge.org/blog/ https://emscripten-forge.org/blog/ : pixi run setup pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/regex Pixi doesn't yet support building wheels though, just conda recipes. Does cibuildwheel already have this new support for building WASM pyodide packages? Does jupyterlite's `micropip install` install these new WASM packages from PyPI?