[HN Gopher] Extending web applications with WebAssembly and Python
       ___________________________________________________________________
        
       Extending web applications with WebAssembly and Python
        
       Author : ereslibre
       Score  : 83 points
       Date   : 2023-05-10 14:13 UTC (8 hours ago)
        
 (HTM) web link (wasmlabs.dev)
 (TXT) w3m dump (wasmlabs.dev)
        
       | angelmm wrote:
       | You can find all the code from this article on GitHub [0].
       | 
       | - [0] https://github.com/vmware-labs/webassembly-language-
       | runtimes...
        
       | krishadi wrote:
       | 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?
        
         | angelmm wrote:
         | 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/
        
       | pininja wrote:
       | Is there a project to package up static python modules to run in-
       | browser using one of their web assembly runtimes?
        
         | robby_w_g wrote:
         | I think Pyodide is what you want.
         | 
         | https://pyodide.org/en/stable/
        
           | baudaux wrote:
           | Sounds great, I will put it in my new operating system
           | running in the browser https://extendedmachine.com.
        
         | ereslibre wrote:
         | 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.
        
       | samsquire wrote:
       | This is awesome. Thanks for doing this.
       | 
       | Took me a while to understand that exports are available for the
       | wasm module to call and imports are what the wasm module can see
       | to call.
        
       | ridruejo wrote:
       | 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 ...
        
         | zcw100 wrote:
         | 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
        
       ___________________________________________________________________
       (page generated 2023-05-10 23:01 UTC)