2022-05-31 08:39:46 +00:00
|
|
|
# wamr-python
|
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
The WAMR Python package contains a set of high-level bindings for WAMR API and WASM-C-API.
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
## Installation
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-05-24 00:15:28 +00:00
|
|
|
* **Notice**: This python package need python >= `3.9`.
|
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
To Install from local source tree in _development mode_ run the following command,
|
2022-05-31 08:39:46 +00:00
|
|
|
|
|
|
|
```bash
|
2023-02-16 07:21:28 +00:00
|
|
|
python -m pip install -e .
|
2022-05-31 08:39:46 +00:00
|
|
|
```
|
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
In this mode the package appears to be installed but still is editable from the source tree.
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
## Usage
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
From the same package you can use two set of APIs.
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
To use the WAMR API you can import the symbols as follows,
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
```py
|
|
|
|
from wamr.wamrapi.wamr import Engine, Module, Instance, ExecEnv
|
|
|
|
```
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
In the order hand, to use the WASM-C-API,
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
```py
|
|
|
|
import wamr.wasmcapi.ffi as ffi
|
|
|
|
```
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-02-16 07:21:28 +00:00
|
|
|
For more information:
|
2022-05-31 08:39:46 +00:00
|
|
|
|
2023-05-02 01:12:49 +00:00
|
|
|
* [WAMR API](./wamr-api)
|
|
|
|
* [WASM-C-API](./wasm-c-api)
|