2023-02-16 07:21:28 +00:00
|
|
|
# WARM API
|
|
|
|
|
2024-03-14 07:30:28 +00:00
|
|
|
* **Notice**: The python package `wamr.wamrapi.wamr` need python >= `3.10`.
|
2023-05-24 00:15:28 +00:00
|
|
|
|
2023-02-28 08:19:17 +00:00
|
|
|
## Setup
|
2023-02-16 07:21:28 +00:00
|
|
|
|
2023-02-28 08:19:17 +00:00
|
|
|
### Pre-requisites
|
2023-02-16 07:21:28 +00:00
|
|
|
|
2023-02-28 08:19:17 +00:00
|
|
|
Install requirements,
|
2023-02-16 07:21:28 +00:00
|
|
|
|
2024-03-14 07:30:28 +00:00
|
|
|
```shell
|
2023-02-28 08:19:17 +00:00
|
|
|
pip install -r requirements.txt
|
2023-02-16 07:21:28 +00:00
|
|
|
```
|
|
|
|
|
2023-02-28 08:19:17 +00:00
|
|
|
### Build native lib and update bindings
|
2023-02-16 07:21:28 +00:00
|
|
|
|
2023-02-28 08:19:17 +00:00
|
|
|
The following command builds the iwasm library and generates the Python bindings,
|
2023-02-16 07:21:28 +00:00
|
|
|
|
2023-02-28 08:19:17 +00:00
|
|
|
```sh
|
2024-03-14 07:30:28 +00:00
|
|
|
# In WAMR root directory
|
2023-02-28 08:19:17 +00:00
|
|
|
bash language-bindings/python/utils/create_lib.sh
|
2023-02-16 07:21:28 +00:00
|
|
|
```
|
|
|
|
|
2023-02-28 08:19:17 +00:00
|
|
|
This will build and copy libiwasm into the package.
|
2023-02-16 07:21:28 +00:00
|
|
|
|
2023-08-15 02:32:43 +00:00
|
|
|
## Samples
|
2023-02-28 08:19:17 +00:00
|
|
|
|
2023-08-15 02:32:43 +00:00
|
|
|
- **[basic](./samples/basic)**: Demonstrating how to use basic python bindings.
|
|
|
|
- **[native-symbol](./samples/native-symbol)**: Desmostrate how to call WASM from Python and how to export Python functions into WASM.
|