wasmtime-py
is a Bytecode Alliance project. It follows the Bytecode
Alliance's Code of Conduct and Organizational Code of Conduct.
So far this extension has been written by folks who are primarily Rust programmers, so feel free to create a PR to help make things more idiomatic if you see something!
You'll need to acquire a Wasmtime installation. The wasmtime-py
package
expects your platform's shared library to exist at wasmtime/{host}/_{library}
.
You can download the latest development version of Wasmtime by running a script
in the top-level directory of the package's source (this is what CI does):
$ python ci/download-wasmtime.py
Otherwise if you have a local checkout of Wasmtime you can symlink its
libwasmtime.so
(or equivalent) to wasmtime/linux-x86_64/_libwasmtime.so
(or
equivalent).
Next the bindings generation requires compiling some Rust code to WebAssembly.
This requires the wasip1
Rust target be installed (rustup target add wasm32-wasip1
)
as well as wasm-tools
(cargo install wasm-tools
), and then run:
$ python ci/build-rust.py
Finally, install the dev dependencies with pip
:
$ pip install -e ".[testing]"
On Windows, the below will require gcc
to be installed locally and on the PATH.
The easiest way to do this is via an installer such as https://github.com/msys2/msys2-installer/releases/download/2024-12-08/msys2-x86_64-20241208.exe
,
and then in the MSYS2 terminal run the command pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
to install GCC. Put C:\msys64\ucrt64\bin
(or
wherever you installed GCC to) on the end of the PATH (if earlier on the PATH its
version of Python may get picked up before the desired version).
After you've completed the set up steps, you can run the tests locally with
pytest
:
$ pytest
The CI for this project does a few different things:
-
API docs are generated for pushes to the
main
branch and are published online. -
Test coverage information is generated for pushes to the
main
branch and are available online. -
Each push to
main
will publish a release to test.pypi.org for local inspection. -
Tagged commits will automatically be published to pypi.org.
All commits/PRs run the full test suite, and check for code style and other errors using flake8.