Wenyong Huang 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
..
docs 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
samples 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
tests 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
utils 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
wamr 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
.gitignore 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
LICENSE 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
README.md 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
pyproject.toml 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
requirements.txt 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans
setup.py 3d34a91f0b Implement Python language binding (#1192) (#1195) il y a 3 ans

README.md

wamr-python

Installation

Installing from the source code

Installing from local source tree is in development mode. The package appears to be installed but still is editable from the source tree.

$ python -m pip install -e /path/to/wamr-root/binding/python

Usage

import wamr.ffi as ffi

Preparation

The binding will load the shared library libiwasm.so from the WAMR repo. So before running the binding, you need to build the library yourself.

The default compile options are good enough.

Please be aware that wasm_frame_xxx and wasm_trap_xxx only work well when enabling WAMR_BUILD_DUMP_CALL_STACK.

Examples

There is a simple example to show how to use bindings. Actually, the python binding follows C-APIs. There it should be easy if be familiar with programming with wasm-c-api.

Unit test cases under ./tests could be another but more complete references.