11 comments

  • simonw8 hours ago
    I&#x27;ve been looking forward to this for ages!<p>This means we can now take any C&#x2F;Rust&#x2F;whatever extension for Python, compile that as a `.wasm` extension, and then load it directly in browser Pyodide projects using:<p><pre><code> await micropip.install(&quot;package-on-pypi&quot;) import package_name </code></pre> Here&#x27;s how to try the new feature out. Visit <a href="https:&#x2F;&#x2F;pyodide.org&#x2F;en&#x2F;stable&#x2F;console.html" rel="nofollow">https:&#x2F;&#x2F;pyodide.org&#x2F;en&#x2F;stable&#x2F;console.html</a> and type:<p><pre><code> import micropip await micropip.install(&quot;pydantic_core&quot;) import pydantic_core </code></pre> That gets you this WASM wheel: <a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;pydantic_core&#x2F;#pydantic_core-2.47.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;pydantic_core&#x2F;#pydantic_core-2.47.0...</a><p>You can tell that it&#x27;s got compiled code in (and not just Python) by running:<p><pre><code> pydantic_core._pydantic_core </code></pre> I get this:<p><pre><code> &lt;module &#x27;pydantic_core._pydantic_core&#x27; from &#x27;&#x2F;lib&#x2F;python3.14&#x2F;site-packages&#x2F;pydantic_core&#x2F;_pydantic_core.cpython-314-wasm32-emscripten.so&#x27;&gt;</code></pre>
    • simonw7 hours ago
      I 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.<p>Here&#x27;s the package: <a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;luau-wasm&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;luau-wasm&#x2F;</a><p><pre><code> import micropip await micropip.install(&quot;luau-wasm&quot;) import luau_wasm print(luau_wasm.execute(r&#x27;&#x27;&#x27; local animals = {&quot;fox&quot;, &quot;owl&quot;, &quot;frog&quot;, &quot;rabbit&quot;} table.sort(animals, function(a, b) return #a &lt; #b end) for i, name in animals do print(i .. &quot;. &quot; .. name .. &quot; (&quot; .. #name .. &quot;)&quot;) end &#x27;&#x27;&#x27;)) </code></pre> And an interactive demo page where you can try it out: <a href="https:&#x2F;&#x2F;simonw.github.io&#x2F;luau-wasm&#x2F;" rel="nofollow">https:&#x2F;&#x2F;simonw.github.io&#x2F;luau-wasm&#x2F;</a><p>Wrote about this in more detail on my blog: <a href="https:&#x2F;&#x2F;simonwillison.net&#x2F;2026&#x2F;Jun&#x2F;13&#x2F;publishing-wasm-wheels&#x2F;" rel="nofollow">https:&#x2F;&#x2F;simonwillison.net&#x2F;2026&#x2F;Jun&#x2F;13&#x2F;publishing-wasm-wheels...</a>
    • rtpg3 hours ago
      Is there any form of client-side caching that kicks in with all of this flow?<p>Tbh I don&#x27;t feel great about people just writing up a bunch of scripts pulling things just on every run.
      • simonw3 hours ago
        Browser caching works with stuff pulled from PyPI, so it shouldn&#x27;t get loaded more than once.
    • willXare6 hours ago
      `await micropip.install()` is starting to feel dangerously close to &quot;just ship the whole universe to the browser.&quot;
  • 12_throw_away8 hours ago
    Executing normal python programs inside a cpython 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&#x27;re at it though.)
    • apitman7 hours ago
      I&#x27;m sure everyone has seen this by now but just in case: <a href="https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death-of-javascript" rel="nofollow">https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death...</a>
      • hoodchatham1 hour ago
        That video was a major inspiration for me and probably indirectly led to me becoming a Pyodide maintainer.
    • willXare6 hours ago
      We heard you like runtimes, so we put a runtime in your runtime inside your runtime.
    • rvz7 hours ago
      This sounds like a solution looking for an unnecessary security nightmare.<p>Something as little as the runtime can just get exploited (which that as happened.) and cause a sandbox escape on the client side. There was a Chrome 0day at the runtime level which allowed untrusted code to run and escape the sandbox in the WASM runtime.<p>This complete worship of WASM (and their runtimes) as this magical silver bullet reminds me of the days and failures of Native Client (NaCL), Java Applets and Flash all over again.
      • simonw5 hours ago
        You mean this one? <a href="https:&#x2F;&#x2F;theori.io&#x2F;blog&#x2F;a-deep-dive-into-v8-sandbox-escape-technique-used-in-in-the-wild-exploit" rel="nofollow">https:&#x2F;&#x2F;theori.io&#x2F;blog&#x2F;a-deep-dive-into-v8-sandbox-escape-te...</a><p>I dunno, one sandbox escape in nine years is a pretty solid track record IMO.<p>Any reason WASM is more dangerous than regular JavaScript?
        • rvz3 hours ago
          No. This one. [0].<p>Even before that, there are several other sandbox escapes that predated the one you posted. [1] [2] and this one [3] can be used to trivially escape its sandbox with either of these vulnerabilities.<p>So it is not the magical silver bullet one may easily think it is.<p>[0] <a href="https:&#x2F;&#x2F;nvd.nist.gov&#x2F;vuln&#x2F;detail&#x2F;CVE-2026-11645" rel="nofollow">https:&#x2F;&#x2F;nvd.nist.gov&#x2F;vuln&#x2F;detail&#x2F;CVE-2026-11645</a><p>[1] <a href="https:&#x2F;&#x2F;blog.ret2.io&#x2F;2021&#x2F;06&#x2F;02&#x2F;pwn2own-2021-jsc-exploit&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.ret2.io&#x2F;2021&#x2F;06&#x2F;02&#x2F;pwn2own-2021-jsc-exploit&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;issues.chromium.org&#x2F;issues&#x2F;40091185" rel="nofollow">https:&#x2F;&#x2F;issues.chromium.org&#x2F;issues&#x2F;40091185</a><p>[3] <a href="https:&#x2F;&#x2F;phrack.org&#x2F;issues&#x2F;72&#x2F;10_md#article" rel="nofollow">https:&#x2F;&#x2F;phrack.org&#x2F;issues&#x2F;72&#x2F;10_md#article</a>
      • nextaccountic1 hour ago
        &gt; Something as little as the runtime can just get exploited (which that as happened.) and cause a sandbox escape on the client side.<p>Sandbox escapes could happen in Javascript too, right? But I don&#x27;t see people avoiding browsing the web because of that
  • njoyablpnting2 hours ago
    Pyodide is great. I teach coding to kids, mostly creating 2d games with Python, and it was always a pain to manage an environment for each student. Now I have a browser based environment that runs Pygame&#x2F;Arcade&#x2F;Pyglet in Pyodide, so the kids can just do everything in the browser, I don&#x27;t have to worry about Python versions, OS differences, files, etc. As a bonus they can easily publish what they make since it all runs in browser.<p>They haven&#x27;t made anything too crazy, but performance is surprisingly good, even wiring in Pymunk for some physics stuff. If they get to the point where it&#x27;s ever an issue they probably know enough to be working in a real game engine anyway.
  • willXare6 hours ago
    Python in the browser keeps sounding ridiculous right up until it works.
  • zek4 hours ago
    I&#x27;ve been working on a server-side wasm impl of cpython called boomslang [1] and have been thinking a lot lately about packaging, one of the downsides of my current impl is the need to statically link all c&#x2F;rust extensions. Its too bad IMO how much of the wasm ecosystem targets&#x2F;depends on emscripten directly. It&#x27;d be interesting to see if a more generic ABI could be provided for non emscripten&#x2F;js based wasm runtimes.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;HubSpot&#x2F;boomslang" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;HubSpot&#x2F;boomslang</a>
    • DarkUranium3 hours ago
      I think one of the issues is that WASM is notoriously hard to generate code for because they decided to use an IR that&#x27;s fundamentally incompatible with literally any existing native compiler backend&#x27;s IR (not counting very specialized ones or toy direct-ast-to-machine-code compilers).<p>It feels like nobody actually consulted actual compiler writers when designing this. I&#x27;m sure that isn&#x27;t true, but it definitely feels that way. (I suspect the truth is that they were consulted, but ignored.)<p>It means codegen needs to resort to all sorts of hacks (like the relooper) in order to target WASM, a property not shared by <i>any</i> other target.<p>And apparently, the way they handle variables also results in deoptimization, though I don&#x27;t recall the details of that.<p>Add the fact that interacting with the browser on the web <i>still</i> has to go via JavaScript to this day (for the most part, at least), and, well.<p>---<p>TL;DR a combination of poor IR design that has a massive impedance mismatch with pre-existing compilers (and most new ones, because it turns out there&#x27;s a reason the WASM approach isn&#x27;t standard) plus WASM still being a second-class citizen in its supposed primary environment (the &#x27;W&#x27; in WASM) --- the former ensures targeting it consumes a lot of resources&#x2F;time, the latter ensures the bar for that to be worth it is much higher.<p>You can target most architectures with little trouble (at least a a baseline --- optimization&#x27;s a hard problem regardless of target, except maybe SPIR-V due to the recommendation that pre-optimization is limited in scope). But WASM is completely out there, it&#x27;s closer to trying to target e.g. Java (not JVM!) at the backend instead of machine code or some other IR.<p>You don&#x27;t make an IR intended to be targeted by existing&#x2F;native compilers by making it completely different to anything they had to target before <i>and</i> completely different to their own IRs and representations ... unless you&#x27;re the guys behind WASM.
      • ameliaquining3 hours ago
        I don&#x27;t think the controversy about Wasm&#x27;s structured control flow has anything to do with any of this? It&#x27;s not actually difficult to target Wasm in codegen; I&#x27;ve never heard of any real-world compiler project complaining that this was a major burden. ABI concerns are at a different level.<p>Most low-level IRs don&#x27;t do structured control flow because most low-level IRs don&#x27;t need to be translatable to verified-safe machine code in a single fast pass, whereas for WebAssembly that&#x27;s a core design requirement.
        • csande171 hour ago
          <a href="http:&#x2F;&#x2F;troubles.md&#x2F;posts&#x2F;why-do-we-need-the-relooper-algorithm-again&#x2F;" rel="nofollow">http:&#x2F;&#x2F;troubles.md&#x2F;posts&#x2F;why-do-we-need-the-relooper-algorit...</a> has a more detailed version of this argument: if WebAssembly had used a CFG as the basis for its control flow, it would have been easier to compile to <i>and</i> easier to efficiently execute&#x2F;translate while maintaining safety, and maybe GCC would have released a WebAssembly backend by now.<p>The author alleges that the real reason WebAssembly uses loop&#x2F;block is because that&#x27;s how V8 worked internally at the time and Google didn&#x27;t want to go to the trouble of implementing something different. But more recently V8 has started moving towards CFGs ( <a href="https:&#x2F;&#x2F;v8.dev&#x2F;blog&#x2F;leaving-the-sea-of-nodes" rel="nofollow">https:&#x2F;&#x2F;v8.dev&#x2F;blog&#x2F;leaving-the-sea-of-nodes</a> ) so maybe there&#x27;s hope in the future.
      • hmry2 hours ago
        From what I remember, it was specifically chosen (among other reasons) because of experience with the JVM, where it was difficult to verify bytecode type-safety due to unrestricted jumps and branches.<p>So the choice was made to put the burden of regularizing the control flow on the compilers at compile time, rather than the browser engine at website load time. Which seems rational to me.
  • wolfgangK8 hours ago
    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&#x27;s dnn goodies being available on a zero-install client side Notebook !<p>[0] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=48421858">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=48421858</a>
    • simonw8 hours ago
      Yeah it should definitely work there, anything you can `micropip.install()` into a Pyodide environment will work with JupyterLite.
  • fzumstein8 hours ago
    Pyodide 314.0 is already available in xlwings Lite (the Python in Excel alternative you actually wanted).
  • efromvt5 hours ago
    Fantastic to have PyO3&#x2F;Maturin guides too - the rust&#x2F;python&#x2F;typescript turducken I’ve always wanted.
  • runningmike9 hours ago
    Great news. And indeed a nice step to an even broader Python ecosystem.
  • sgammon8 hours ago
    nice to see JS&#x2F;python interop becoming a thing
  • agrijakhetarpal5 hours ago
    [flagged]