A basic example of calling Rust from Python used as example in the blogposts:
- Rust-scales Python: Basic experiment
- Rust-scales Python: Example 1
- [Rust-scales Python: Flask experiment] (https://dev.to/tuned/rust-scales-python-flask-experiment-4l4l)
Ensure that you have both Rust and Python3 installed.
Update to the latest version of Rust
rustup update
Add the Wasm target:
rustup target add wasm32-unknown-unknown
Install Rust dependencies:
cargo build --release --target wasm32-unknown-unknown
Install wasmer for Python:
python3.6 -m pip install wasmer
# Or, on some systems:
pip3 install wasmer
cd pywasm
python3 run_wasm_with_python.py
python3 run_flask_bench.py
If everything is working correctly, you should see output that take timing of the functions run using python-ext-wasm and pure Python.