You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wasm3/platforms/python
Volodymyr Shymanskyy 38fc6dcb9e
Optimize after asyncify
3 years ago
..
examples Optimize after asyncify 3 years ago
test Test harness: support multi-values 3 years ago
.gitignore Update python bindings. New API + Dino game using PyWasm! 3 years ago
LICENSE Publish pywasm3 to pypi 4 years ago
MANIFEST.in Boost pywasm3 version 4 years ago
README.md Update examples 3 years ago
m3 Move setup.py to python platform 4 years ago
m3module.c Add Gas Metering for pywasm3 3 years ago
setup.py Add Gas Metering for pywasm3 3 years ago

README.md

pywasm3

Python binding for Wasm3, the fastest WebAssembly interpreter.

Install

pip3 install pywasm3

# Or, if you have a local copy:
python3 setup.py sdist
pip3 install dist/pywasm3-*.tar.gz

Usage example

import wasm3, base64

# WebAssembly binary
WASM = base64.b64decode("AGFzbQEAAAABBgFgAX4"
    "BfgMCAQAHBwEDZmliAAAKHwEdACAAQgJUBEAgAA"
    "8LIABCAn0QACAAQgF9EAB8Dws=")

env = wasm3.Environment()
rt  = env.new_runtime(1024)
mod = env.parse_module(WASM)
rt.load(mod)
func = rt.find_function("fib")
result = func.call_argv("24")
print(result)                       # 46368

License

This project is released under The MIT License (MIT)