Live data from Hacker News

Running Python code in a sandbox with MicroPython and WASM

simonwillison.net

31–40 of 46 posts

Re: Running Python code in a sandbox with MicroPython and WASM

#31

I build a lightweight vm here that fits your needs as well: https://github.com/smol-machines/smolvm

The thing that's missing is Windows support and the ability to get everything I need for it in a Python program by "pip install X" for something that includes relevant binaries as well as Python code.

Re: Running Python code in a sandbox with MicroPython and WASM

#32
post #26

On linux I devised this strategy for letting llm webuis or coding agent to securely run programs by burying their environment under multiple layers of locally arranged sandboxing. Basically: run as another user -> run inside firejail sandbox -> run inside a stripped down alpine linux vm with smolvm. See the whole procedure here: https://www.reddit.com/r/LocalLLaMA/comments/1tm93ng/how_i_d... P.S. directories can be e…

Interesting middle ground between full WASM lockdown and a bare environment. Did you end up needing to block anything else beyond the package manager?

Re: Running Python code in a sandbox with MicroPython and WASM

#33

We are working to solve the "sandoxing in Wasm" problem across multiple runtimes. https://labs.leaningtech.com/blog/browserpod-deep-dive Node.js is now fully supported, Python is in preview and Rust is coming soon. For a glimpse of the possibilities, check our Claude Code running fully in the browser: https://browsercode.io/claude

Been working on something similar based on Webcontainers. How does your Node.js support compare with StackBlitz technology?

Are you running the version of Claude code that Anthropic distributes in the browser or did you have to adapt it to run on your stack?

Cheers

Re: Running Python code in a sandbox with MicroPython and WASM

#34
post #27

Earlier quoted context omitted.

Any thoughts on https://github.com/dylan-sutton-chavez/edge-python or http://edgepython.com/ ?

Ok that looks promising! I like that it's built for WASM, and the docs mention wasmtime here: https://edgepython.com/getting-started/what-it-is

Kind of crazy how many bespoke python sandbox implementations have popped up in the past few months.

I’d love to see if we can get GPU access within these runtimes, that’d be awesome.

Re: Running Python code in a sandbox with MicroPython and WASM

#35
post #33

We are working to solve the "sandoxing in Wasm" problem across multiple runtimes. https://labs.leaningtech.com/blog/browserpod-deep-dive Node.js is now fully supported, Python is in preview and Rust is coming soon. For a glimpse of the possibilities, check our Claude Code running fully in the browser: https://browsercode.io/claude

Been working on something similar based on Webcontainers. How does your Node.js support compare with StackBlitz technology? Are you running the version of Claude code that Anthropic distributes in the browser or did you have to adapt it to run on your stack? Cheers

Our technology is much more general that WebContainers, and it's based on a Linux-compatible WebAssembly kernel. It also supports real command line tools, including git, bash and the complete set of busybox utilities.

The version of Claude Code you see running is completely unmodified.

Re: Running Python code in a sandbox with MicroPython and WASM

#36

If you're interested in not reinventing the sandbox for LLMs, consider Judge0: https://judge0.com/ I have absolutely no relation to the project except for the fact that I went to the same Uni as the creator.

Do you know if it has any kind of orchestration/queue support or if there's another project that does it embedding Judge0?

Re: Running Python code in a sandbox with MicroPython and WASM

#37
post #36

If you're interested in not reinventing the sandbox for LLMs, consider Judge0: https://judge0.com/ I have absolutely no relation to the project except for the fact that I went to the same Uni as the creator.

Do you know if it has any kind of orchestration/queue support or if there's another project that does it embedding Judge0?

No idea, I expect that it does since it's very performant. I would totally reach out to the support

Re: Running Python code in a sandbox with MicroPython and WASM

#38
post #33

Earlier quoted context omitted.

Been working on something similar based on Webcontainers. How does your Node.js support compare with StackBlitz technology? Are you running the version of Claude code that Anthropic distributes in the browser or did you have to adapt it to run on your stack? Cheers

Our technology is much more general that WebContainers, and it's based on a Linux-compatible WebAssembly kernel. It also supports real command line tools, including git, bash and the complete set of busybox utilities. The version of Claude Code you see running is completely unmodified.

Awesome, what approach are you using? Is this a real micro kernel architecture or just containerized VM?

Re: Running Python code in a sandbox with MicroPython and WASM

#39
post #38

Earlier quoted context omitted.

Our technology is much more general that WebContainers, and it's based on a Linux-compatible WebAssembly kernel. It also supports real command line tools, including git, bash and the complete set of busybox utilities. The version of Claude Code you see running is completely unmodified.

Awesome, what approach are you using? Is this a real micro kernel architecture or just containerized VM?

The architecture is a fairly straightforward WebAssembly-native monolithic kernel. Most of the complexities come from making things work well within the browser constraints for real world, large apps.

We have quite a bit of experience on the topic however, these are previous projects of ours:

WebVM (https://webvm.io): x86 Debian shell running client-side in the browser via x86 -> WebAssembly JIT compilation

Browsercraft (https://browsercraft.cheerpj.com): Minecraft running unmodified in the browser via our WebAssembly JVM (CheerpJ)

Re: Running Python code in a sandbox with MicroPython and WASM

#40
post #38

Earlier quoted context omitted.

Awesome, what approach are you using? Is this a real micro kernel architecture or just containerized VM?

The architecture is a fairly straightforward WebAssembly-native monolithic kernel. Most of the complexities come from making things work well within the browser constraints for real world, large apps. We have quite a bit of experience on the topic however, these are previous projects of ours: WebVM ( https://webvm.io ): x86 Debian shell running client-side in the browser via x86 -> WebAssembly JIT compilation Browser…

Oh, you are the author of WebVM, pretty cool! I looked at it while choosing the stack for our project and it seems very solid.

Keep up the great work

Post reply on HN