componentize-py
cxx-wasm-freestanding
componentize-py | cxx-wasm-freestanding | |
---|---|---|
2 | 1 | |
123 | 3 | |
17.9% | - | |
8.5 | 10.0 | |
about 1 month ago | over 2 years ago | |
Rust | C++ | |
Apache License 2.0 | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
componentize-py
-
WASM by Example
The component model is already shipping in Wasmtime, and will be stable for use in Node.js and in browsers via jco (https://github.com/bytecodealliance/jco) soon. WASI Preview 2 will be done in December or January, giving component model users a stable set of interfaces to use for scheduling, streams, and higher level functionality like stdio, filesystem, sockets, and http on an opt-in basis. You should look at wit-bindgen (https://github.com/bytecodealliance/wit-bindgen) to see some of the languages currently supported, and more that will be mature enough to use very soon (https://github.com/bytecodealliance/componentize-py)
Right now jco will automatically generate the JS glue code which implements a Component Model runtime on top of the JS engine's existing WebAssembly implementation. So, yes, Components are a composition of Wasm Modules and JS code is handling passing values from one module/instance to another. You still get the performance benefits of running computation in Wasm.
One day further down the standardization road, we would like to see Web engines ship a native implementation of the Component Model, which might be able to make certain optimizations that the JS implementation cannot. Until then you can consider jco a polyfill for a native implementation, and it still gives you the power to compose isolated programs written in many languages and run them in many different contexts, including the Web.
(Disclosure: I am co-chair of WASI, Wasmtime maintainer, implemented many parts of WASI/CM)
-
Spin 2.0 – open-source tool for building and running WASM apps
(As a side note for the JS support — adapting QuickJS has been extremely helpful in getting JS support out; however, we are in the process of rebuilding the JS runtime using SpiderMonkey (with which a few people on the team have significant experience) and JCO (https://github.com/bytecodealliance/jco), and the web platform compatibility makes it a significantly better proposition for things like 3rd party dependencies).
C# is an interesting one — the .NET team at Microsoft (and in particular Steve Sanderson from that team) has been making tremendous progress in ahead-of-time compilation for .NET and generating Wasm and WASI compatible binaries (as opposed to their initial approach on Blazor), and experimenting with that led us to build support for Spin as well.
Finally, we do a lot to support other popular languages and their Wasm support — two examples: Python (https://github.com/bytecodealliance/componentize-py) and Java / TeaVM (https://github.com/fermyon/teavm-wasi), for which we haven't fully integrated Spin support, but we hope to get there soon.
I hope this explains a bit our process on language support, happy to expand on any point here.
cxx-wasm-freestanding
-
WASM by Example
Hello world just needs to call console.log, so doesn't need libc. Here's an example that builds without libc / emscripten to produce a very small wasm hello world: https://github.com/nikki93/cxx-wasm-freestanding
You do need some JS code that asks the browser to run the wasm blob. You can't eg. just have a script tag that refers to a wasm blob yet.
libc does help with things like having an allocator or string operations etc., or for using C libraries that use libc. And that's where emscripten becomes helpful.
Browser functionality like the console or making html elements is exposed through JS interfaces, and the wasm needs
What are some alternatives?
jco - JavaScript tooling for working with WebAssembly Components
wasm-by-example - Wasm By Example is a website with a set of hands-on introduction examples and tutorials for WebAssembly (Wasm)
zig-spin - 🪀 Zig SDK for the Spin serverless application framework created by @fermyon.
dcraw - Mirror of Dave Coffin's dcraw, with full history
dotnet-pdk - Extism Plug-in Development Kit (PDK) for C# and F#
wit-bindgen - A language binding generator for WebAssembly interface types
teavm-wasi - Friendly fork of TeaVM with support for WASI and the WebAssembly Component Model
spin-js-sdk - https://developer.fermyon.com/spin/javascript-components
wazero - wazero: the zero dependency WebAssembly runtime for Go developers