Python on the Edge: Fast, sandboxed, and powered by WebAssembly
26 comments
·September 24, 2025simonw
OK this looks promising:
brew install wasmer
wasmer run python/python@=0.2.0
Running that gave me a Python 3.12 shell apparently running entirely in a WebAssembly sandbox!I've been trying to find a robust, reliable and easy way to run a Python process in WebAssembly (outside of a browser) for a few years.
syrusakbary
Thanks!
Forgot to put it on the article, but the latest Python requires the Wasmer rc.5 to run! (the final release will be coming very soon)
curl https://get.wasmer.io -sSfL | sh -s "v6.1.0-rc.5"
wasmer run python/python
null
theanonymousone
Hasn't Pyodide been available for some years now?
simonw
Yes but it works only in the browser - running Pyodide outside of a browser is a lot of extra work.
My previous attempts are described here:
- https://til.simonwillison.net/deno/pyodide-sandbox
- https://til.simonwillison.net/webassembly/python-in-a-wasm-s...
almostgotcaught
not true
pyodide venv .venv-pyodide
source .venv-pyodide/bin/activate
I don't know what runtime it uses but I have tests in nightly CI that run exactly like this.see https://pyodide.org/en/stable/development/building-packages-...
theanonymousone
Wondering how this compares to e.g. Jep for Java/Python interoperability (https://github.com/ninia/jep).
Would be way more exciting if it could _compile_ Python to Wasm (or does it?).
didip
How does WASM replace/implement language specific features like goroutines or Python's asyncio loop, or the specifics of each language's GC?
codedokode
I tried to understand what is "Wasmer Edge" but couldn't. They say on the front page "Make any app serverless. The cheapest, fastest and most scalable way to deploy is on the edge." and it seems like I can upload the source code of any app and they will convert it for me? Unlikely so.
Also it says "Pay CDN-like costs for your cloud applications – that’s Wasmer Edge." and I don't understand why I need to pay for the cloud if the app is serverless. That's exactly the point of serverless app that you don't need to pay for the servers because, well, the name implies that there is no server.
simonw
Confusingly, "Serverless" doesn't mean there's no server. It means that you don't have to manage a server yourself.
My preferred definition of serverless is scale-to-zero - where if your app isn't getting any traffic you pay nothing (as opposed to paying a constant fee for having your own server running that's not actually doing any work), then you pay more as the traffic scales up.
Frustratingly there are some "serverless" offerings out there which DO charge you even for no traffic - "Amazon Aurora Serverless v1" did that, I believe they fixed it in v2.
codedokode
Then it should be called manageless?
DangitBobby
Still confusing, since infrastructure you don't have to manage yourself is sometimes called "managed". It makes sense from the perspective of "you are paying us to manage this for you".
simonw
It's a terrible name, but it's been around for over a decade now so we're stuck with it.
I mostly choose not to use it, because I don't like using ambiguous terminology if I can be more specific instead. So I'll say things like "scale-to-zero".
syrusakbary
Thanks for the feedback.
Normally, if you want to run your apps serverlessly you'll need to adapt your source code to it (both AWS Lambda and Cloudflare Workders require creating a custom HTTP handler).
In our case, you can run your normal server (lets say uvicorn) without any code changes required from our side.
Of course, you can already do this in Docker-enabled workloads: Google Cloud or Fly.io, for example. But that means that your apps will have long cold-start times at a way higher cost (no serverless).
Hope this makes things clear!
codedokode
Thank you for the explanation, now I can better see the differences between "serverless" platforms although I am still a little disappointed that so called "serverless" apps still require a (paid) server despite the name.
__MatrixMan__
This bugs me all the time. Ethernet is serverless. Minesweeper is serverless. AWS Lambda is quite serverful, you're just not allowed to get a shell on that server.
mvhv
I believe "serverless" in this sense means "like AWS lambda". Theoretically you upload some small scripts and they're executed on-demand out of a big resource pool, rather than you paying for/running an entire server yourself.
It seems like a horrible way to build a system with any significant level of complexity, but idk maybe it makes sense for very rarely used and light routes?
999900000999
I actually want browsers to support other languages natively.
Brendan Eich ( the creator of JavaScript) was kind enough chime in that it would be impossible for variety of reasons.
Obviously he knows more about this than me, but I think Google could put Dart in there if they really wanted.
WebAssembly is pretty close though.
willseth
Ideally, sure, but that would increase the already enormous burden of building a standards compliant web browser. For a healthy web ecosystem it's important that not only trillion dollar companies can contribute or compete.
999900000999
Not every single website needs to support every single browser. This is a modern convenience, I was doing QA back in the day when we still had to support Internet explorer.
Internet explorer just didn't provide the same experience as Chrome.
LudwigNagasena
Does your solution support interop between modules written in different languages? I would love to be able to pass POD objects between Python and JS inside the same runtime.
theanonymousone
For a backend project in Java, I use Jep for Python interoperability and making use of Python ecosystem. It gives me a "non-restricted" Python to have in my Java code, something I'm quite happy with. Wondering how this compares to that .
FFI support (like they have) is essential for any alternative Python to be worthwhile because so much of what makes Python useful today is numpy and keras and things like that.
That said, there is a need for accelerating branch pure-python workloads too, I did a lot of work with rdflib where PyPy made all the difference and we also need runtimes that can accelerate those workloads.