The `wasmer-compiler-cranelift` library provides the Cranelift compiler backend for the `wasmer` Python package, enabling the compilation of WebAssembly (Wasm) modules. Cranelift is known for its balanced approach, offering faster compilation times compared to LLVM, moderate runtime performance, and enhanced security against malicious Wasm input. The current Python package version is `1.1.0` (released Jan 2022), though the underlying Wasmer runtime frequently updates, with Wasmer 7.0 (Jan 2026) featuring an upgraded Cranelift backend and new capabilities for Python integration.
pip install wasmer wasmer-compiler-craneliftVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a Wasmer Store with the Cranelift compiler, compile a simple WebAssembly module defined in WAT format, instantiate it, and call an exported function.
Refer to the `wasmer-python` 1.x documentation for updated API usage, particularly for `Store`, `Module`, and `Instance` creation.
Ensure both `wasmer` and `wasmer-compiler-cranelift` are installed: `pip install wasmer wasmer-compiler-cranelift`.
Consider `wasmer-compiler-llvm` for production workloads requiring maximum execution speed: `from wasmer_compiler_llvm import Compiler`.
Verify that a compatible binary wheel is available for your platform/Python version. Check the official `wasmer` documentation or PyPI for supported environments. You might need to build from source in some cases.