mohanson / Pywasm
Licence: mit
A WebAssembly interpreter written in pure Python
Stars: ✭ 292
Programming Languages
python
139335 projects - #7 most used programming language
Labels
Projects that are alternatives of or similar to Pywasm
pywasm3
Python bindings for Wasm3, the fastest WebAssembly interpreter
Stars: ✭ 34 (-88.36%)
Mutual labels: webassembly
Riscv Rust
RISC-V processor emulator written in Rust+WASM
Stars: ✭ 253 (-13.36%)
Mutual labels: webassembly
Dragon Iss Docking Autopilot
Autopilot in Go for docking the SpaceX Dragon capsule in the simulator
Stars: ✭ 276 (-5.48%)
Mutual labels: webassembly
Front-end-tutorial
🐼 最全的资源教程-前端涉及的所有知识体系,并在 Nice Front-end Tutorial 持续更新;
Stars: ✭ 1,655 (+466.78%)
Mutual labels: webassembly
node-wasm-trace
Instruments wasm files and traces execution
Stars: ✭ 24 (-91.78%)
Mutual labels: webassembly
lxgui
Portable, real time, modular and data-driven GUI C++ library.
Stars: ✭ 50 (-82.88%)
Mutual labels: webassembly
Blazorfilereader
Library for creating read-only file streams from file input elements or drop targets in Blazor.
Stars: ✭ 278 (-4.79%)
Mutual labels: webassembly
wasm-arrays
A couple of helper functions to make WebAssembly array parameters easy to use
Stars: ✭ 33 (-88.7%)
Mutual labels: webassembly
Wasm Git
GIT for nodejs and the browser using https://libgit2.org compiled to WebAssembly with https://emscripten.org
Stars: ✭ 261 (-10.62%)
Mutual labels: webassembly
wgpu-rust-renderer
A tiny WebGPU renderer written in Rust
Stars: ✭ 81 (-72.26%)
Mutual labels: webassembly
x-img-diff-js
🎨 JavaScript library which compares 2 images and detect structural difference information using OpenCV(WebAssembly)
Stars: ✭ 43 (-85.27%)
Mutual labels: webassembly
golang-wasm
Golang-WASM provides a simple idiomatic, and comprehensive API and bindings for working with WebAssembly for Go and JavaScript developers
Stars: ✭ 57 (-80.48%)
Mutual labels: webassembly
Wasabi
A dynamic analysis framework for WebAssembly programs.
Stars: ✭ 279 (-4.45%)
Mutual labels: webassembly
Octopus
Security Analysis tool for WebAssembly module (wasm) and Blockchain Smart Contracts (BTC/ETH/NEO/EOS)
Stars: ✭ 261 (-10.62%)
Mutual labels: webassembly
pywasm: A WebAssembly interpreter written in pure Python.
A WebAssembly interpreter written in pure Python.
The wasm version currently in use is: WebAssembly Core Specification, W3C Recommendation, 5 December 2019. Just like Firefox or Chrome does.
Installation
$ pip3 install pywasm
Some simple examples
-
First we need a wasm module! Grab our
./examples/fib.wasm
file and save a copy in a new directory on your local machine. Note:fib.wasm
was compiled from./examples/fib.c
by WasmFiddle. -
Now, compile and instantiate WebAssembly modules directly from underlying sources. This is achieved using the
pywasm.load
method.
import pywasm
# pywasm.on_debug()
runtime = pywasm.load('./examples/fib.wasm')
r = runtime.exec('fib', [10])
print(r) # 55
A brief description for ./examples
File | Description |
---|---|
./examples/add.wasm | Export i32.add function |
./examples/env.wasm | Call python/native function in wasm |
./examples/fib.wasm | Fibonacci, which contains loop and recursion |
./examples/str.wasm | Export a function which returns string |
./examples/sum.wasm | Equal difference series summation |
Of course there are some more complicated examples!
- Zstandard decompression algorithm: https://github.com/dholth/zstdpy
- Run AssemblyScript on pywasm: https://github.com/mohanson/pywasm_assemblyscript
Test
$ python3 ./test/test_spec.py
Tested in the following environments:
- Python >= 3.6
Thanks
License
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].