from Hacker News

Python on the Edge: Fast, sandboxed, and powered by WebAssembly

by baalimago on 9/24/25, 3:48 PM with 158 comments

  • by simonw on 9/24/25, 4:12 PM

    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.

  • by anentropic on 9/25/25, 9:59 AM

    The close to 'native' Python performance looks promising!

    Just want to point out that this section avoids mentioning the best way to do it:

      > AWS Lambda doesn't natively run unmodified Python apps:
      >
      > - You need adapters (such as https://github.com/slank/awsgi or https://github.com/Kludex/mangum) for running your WSGI sites.
      > - WebSockets are unsupported.
      > - Setup is complex, adapters are often unmaintained.
    
    AWS provides https://github.com/awslabs/aws-lambda-web-adapter which is a) supported and b) written Rust, providing a translation of Lambda requests back into HTTP so you can use your usual entry point to the WSGI app. It is simple to set up.

    WebSockets still not supported of course, but the issue of adapters is solved.

  • by PaulHoule on 9/24/25, 5:32 PM

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

  • by rcarmo on 9/24/25, 7:48 PM

    Nice, but every time I look into WASM I have to wonder if containers and/or lite weight VMs wouldn’t be simpler and have less restrictions. We seem to have forgotten about microkernels and custom runtimes (like the various Erlang ones) as well…

    Still, that close to native Python is an interesting place to be.

  • by spicypixel on 9/24/25, 9:24 PM

    Are we at the point where I can store arbitrary scripts in a sql database and execute them with arguments, safely in a python sandbox from a host language that may or may not be python, and return the value(s) to the caller?

    I'd love to implement customer supplied transformation scripts for exports of data but I need this python to be fully sandboxed and only operate on the data I give it.

  • by didip on 9/24/25, 5:20 PM

    How does WASM replace/implement language specific features like goroutines or Python's asyncio loop, or the specifics of each language's GC?
  • by 999900000999 on 9/24/25, 5:06 PM

    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.

  • by codedokode on 9/24/25, 4:40 PM

    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.

  • by indigodaddy on 9/24/25, 10:37 PM

    Would the app have outbound network access to do some Python scheduling stuff that involves pulling from another endpoint?

    Eg something like this flask-based app? (Yes the code is shit, I’m just a sysadmin learning Python with some AI support at that time).

    https://github.com/jgbrwn/my-upc/blob/main/app.py

    Also, if wasmer supports Starlette, I assume it would support FastHTML (web framework that uses Starlette under the hood) ?

  • by jonny_eh on 9/24/25, 8:56 PM

    I get an https error at https://docs.wasmer.io/: net::ERR_CERT_AUTHORITY_INVALID
  • by HPsquared on 9/24/25, 7:27 PM

    JuputerLite also does this. Uses local storage and Pyodide kernel (python on wasm). It has a special version of pip, and wasm versions of a lot of libraries which usually use native code (numpy etc). Super impressive.

    https://jupyter.org/try-jupyter/lab/

  • by koeng on 9/25/25, 8:06 AM

    Very cool!

    I’ve been looking at using lua for something like this: basically, users will be able to program robots in my lab (biotech) to do things, and I need a scripting language I can easily embed and control the runtime of in the larger system.

    Lua is theoretically better in… almost every way, except everyone in bio uses python. So it could allow more easy modification of LLM generated scripts (not worried about the libraries because I mostly want to limit them: the scripts are mainly to just run robots, and you can have them webhook out if you need complicated stuff)

    My question would be: would running a python sandbox vs a lua sandbox actually be appreciably better? Not sure yet, but will have to investigate with this new package (since it has Go bindings!)

  • by theanonymousone on 9/24/25, 5:15 PM

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

  • by brumar on 9/24/25, 6:35 PM

    Are dependencies easier to install or does it work only for packages that have pure wheel support?
  • by DonHopkins on 9/24/25, 7:53 PM

    WASMBots: Fast, Cheap, and Out Of Control!

    https://people.csail.mit.edu/brooks/papers/fast-cheap.pdf

  • by liqilin1567 on 9/25/25, 4:34 AM

    I am so excited about python edge supported by wasm because I used python on cloudflare worker but there are so many limitations just simple pure python code supported.
  • by selinkocalar on 9/30/25, 1:09 AM

    The sandboxing benefits are real, especially for multi-tenant environments where you can't trust user code. Performance is still going to be hit-or-miss depending on the workload.
  • by crashabr on 9/24/25, 10:21 PM

    I'm not sure I understand correctly: is it a new serverless offering competing with the likes of vercel and fly.io, but with a different technology and pricing strategy? And the wasm container means that I can deploy my streamlit of FastAPI ETL apps without the Docker overhead or slowness of streamlit cloud?
  • by pzo on 9/24/25, 7:10 PM

    Would it be possible to make it work on iOS or android? I always missed better support of python on mobiles. In the past used PythonKit rapid prototype and interop with Swift but had limited set of modules. Wish to use this in react native for interop between js and python
  • by zzzeek on 9/25/25, 2:36 AM

    > Now, you can run any kind of Python API server, powered by fastapi, django, flask, or starlette, connected to a MySQL database automatically when needed

    I assume this is targeting the standalone WebAssembly use case, we're not...running MySQL in browsers right?

  • by Mikhail_K on 9/25/25, 1:01 PM

    Words "Python" and "fast" do not belong in the same sentence.
  • by jiri on 9/25/25, 9:12 AM

    Wouldnt be better to have sandboxing built directly to cpython? Why there is no such thing already "include" in cpython? Or maybe to create some limited sandboxed venv?
  • by LudwigNagasena on 9/24/25, 4:59 PM

    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.
  • by 1024bees on 9/25/25, 2:29 AM

    this rocks, using python as an embedded scripting language is Easy and Cool but also Dangerous and Evil, feel like this could make it less dangerous.
  • by BinaryIgor on 9/25/25, 4:02 PM

    Interesting - do they compile Python to WebAssembly or just have a Python interpreter compiled to WebAssembly and running as usual?
  • by alex_reg on 9/24/25, 6:38 PM

    Hmm, I tried it out.

    > wasmer app create --template=static-website

    gets you from empty folder to initialized template and deployed static website in like 10 seconds when logged in.

    Pretty nice.

  • by Panzerschrek on 9/25/25, 6:05 AM

    Isn't it just Python built with Emscripten?
  • by xrd on 9/25/25, 1:37 PM

    I don't see a mention of uv here.

    Since LLMs have made me so lazy that I never bother to search or read on my own, can someone tell me whether I can use uv as my project management tool with wasmer? What's the story here?

    I simply CANNOT go back to use packages without uv, it would be unthinkable to me.

    Actually, now that I think of it, my laziness might have started when I learned perl 30 years ago.

  • by neuroelectron on 9/25/25, 3:17 AM

    How are you going to sandbox WebAsm when it's not even defined?
  • by pumanoir on 9/24/25, 11:55 PM

    How would i use numpy from javascript using this?
  • by IshKebab on 9/24/25, 9:43 PM

    To be clear "fast" means "almost as fast as native Python", not "actually fast". Impressive achievement anyway.