logoalt Hacker News

Pyodide 314.0: Python packages can now publish WebAssembly wheels to PyPI

46 pointsby agriyakhetarpallast Tuesday at 3:54 PM8 commentsview on HN

Comments

simonwtoday at 9:54 PM

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 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...

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'>
12_throw_awaytoday at 10:26 PM

Executing a python program inside a python vm inside a wasm context inside a javascript process inside a sandbox inside a browser is - genuinely - extremely exciting! (Might as well run the browser inside a container inside a VM while you're at it though.)

wolfgangKtoday at 10:16 PM

I presume this works (will work) also for JupyterLite that is based on Pyodide ? Would be great if it helped getting the latest OpenCV-python version [0] and it's dnn goodies being available on a zero-install client side Notebook !

[0] https://news.ycombinator.com/item?id=48421858

show 1 reply
fzumsteintoday at 10:34 PM

Pyodide 314.0 is already available in xlwings Lite (the Python in Excel alternative you actually wanted).

runningmiketoday at 9:47 PM

Great news. And indeed a nice step to an even broader Python ecosystem.

sgammontoday at 10:35 PM

nice to see JS/python interop becoming a thing