Live data from Hacker News

Spin 3.0 – open-source tooling for building and running WASM apps

fermyon.com

41–44 of 44 posts

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#41
post #10
post #7

Does anyone know what the simplest possible recipe for running a Python script in a WASM sandbox using Spin is? I basically want to do something like this: my-sandbox-cli-tool 'print("hello world") And have the snippet of Python code I provide run inside a WebAssembly container that runs one of the Python compiled to WASM builds ( https://github.com/brettcannon/cpython-wasi-build for example) - with a time limit and…

wasmtime works as long as you make sure to include the lib directory % wasmtime run --dir .::/ python.wasm -c 'print("hello world")' hello world disclaimer: I run a code execution API service ( https://riza.io/playground ) that does this and more (HTTP, packages, etc.)

s/disclaimer/shameless plug/ :P Nothing wrong with it, but not really a disclaimer.

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#43
post #35
post #30

Earlier quoted context omitted.

I am confused. You are referring to wasm modules here? And Component Model / WASI / WIT will give us polyglot interface-based programming then, right? Call each other's methods through the WIT interface between components.

Even the component model has nothing to say about the concept of methods. All you have are top-level functions with immutable arguments and immutable results. You can't hold on to an instance of an object created by the other language. You could hold an integer handle , but then you don't get garbage collection across the two languages. So no, we're still a long way from the abstractions of a JVM, even taking the com…

For the audience that would be looking to use the WASM Component Model, and not be an infrastructure implementer of it, whether or not they meet some definition of a method, the component model does define things called resources [1] that have "methods". You'll hold a "handle" to it like you would in your own programming language with the expected drop and/or GC semantics (once implemented [2]) because code is generated to access it like any other FFI like C/C++.

With that in mind, the other confusing thing one may come across is composition vs linking within your WASM runtime that supports the Component Model. When you hear "composition" think of compile-time merging of libraries such that the bundle may have less unresolved dependencies of WASM code/implemented component interfaces. Anything unresolved needs to be linked at runtime with your WASM runtime of choice, like wasmtime [3]. Pretty interesting reading/potential after reading if you ask me -- sounds like you could implement something like a custom Java classloader hierarchy [4].

But I'd agree with a statement saying it is still a long way for general usage.

[1] https://github.com/WebAssembly/component-model/blob/5a34794d...

[2] https://github.com/WebAssembly/gc

[3] https://github.com/bytecodealliance/wasmtime/blob/ba8131c6bf...

[4] https://www.digitalocean.com/community/tutorials/java-classl...

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#44

Asking a question here that I long wanted to ask. Is it possible to have a python handler function that uses duckdb to query a S3 hosted parquet file and that uses pandas for some data manipulation, run as a WASM app? (leveraging all features of duckdb like predicate pushdown etc)

Maybe something like this? https://duckdb.org/2024/10/02/pyodide.html
Post reply on HN