Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

WebAssembly Interpreter by pure Python

Project description

# pywasm: A WebAssembly interpreter written in pure Python.

[![Build Status](](

A WebAssembly interpreter written in pure Python. JIT used.

Current specification wasm version is: [WebAssembly Core Specification W3C Working Draft, 4 September 2018]( Just like Firefox or Chrome does.

# Installation

$ pip3 install pywasm

# Some simple examples

1. 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](

2. Now, compile and instantiate WebAssembly modules directly from underlying sources. This is achieved using the `pywasm.load` method.

import pywasm
# pywasm.on_debug()

vm = pywasm.load('/src/pywasm/examples/fib.wasm')
r = vm.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 |

# Thanks

- [wagon](, The author is very kind
- [warpy](

# License


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pywasm, version 0.4.5
Filename, size File type Python version Upload date Hashes
Filename, size pywasm-0.4.5.tar.gz (21.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page