Live data from Hacker News

Extending web applications with WebAssembly and Python

wasmlabs.dev

1–10 of 27 posts

Re: Extending web applications with WebAssembly and Python

#3
One of the aspects I find tremendously exciting about Wasm is not just the portability, security, performance, etc. but the fact that you can do this with your language of choice. Lowering the barrier to adoption without hindering some of the advanced use cases tends to work well to get developers onboard ...

Re: Extending web applications with WebAssembly and Python

#7
post #4

Is there a project to package up static python modules to run in-browser using one of their web assembly runtimes?

The webassembly-language-runtimes is focused on providing WASI-based language interpreters, what would require a WASI polyfill at the browser level (https://wasi.dev/polyfill/) and (https://github.com/bjorn3/browser_wasi_shim).

Pyodide is certainly another option, but is emscripten based, not based in webassembly-language-runtimes or WASI.

Re: Extending web applications with WebAssembly and Python

#9
post #3

One of the aspects I find tremendously exciting about Wasm is not just the portability, security, performance, etc. but the fact that you can do this with your language of choice. Lowering the barrier to adoption without hindering some of the advanced use cases tends to work well to get developers onboard ...

It's not quite as open as the language of your choice. There are a handful of popular languages available, Rust, C, C++ and a number of fringe languages like Zig, AssemblyScript, etc. You can run something like Python but it's a bit misleading because you're compiling the entire runtime to WebAssembly similar to how CheerpJ runs Java or Blazor runs .NET

Re: Extending web applications with WebAssembly and Python

#10
post #8

This is exciting! Does that mean that I can load a sqllite db or a duckdb onto the browser through wasm and then connect it with the python env?

The Python builds from the WebAssembly language runtimes [0] project target the WebAssembly System Interfaces (WASI) [1]. It allows the Python interpreter to interact with resources like the filesystem.

Many server-side Wasm runtimes supports WASI out of the box. For the browser, you need to provide a polyfill to emulate these resources like the one provided by the WASI team [2].

Regarding SQLite, these builds include libsqlite so you should be able to use it :)

- [0] https://github.com/vmware-labs/webassembly-language-runtimes

- [1] https://wasi.dev/

- [2] https://wasi.dev/polyfill/

Post reply on HN