Skip to main content

The Cranelift compiler for the `wasmer` package (to compile WebAssembly module)

Project description

Wasmer logo Wasmer Python, the Cranelift compiler PyPI version Wasmer Python Documentation Wasmer PyPI downloads Wasmer Slack Channel

wasmer is a complete and mature WebAssembly runtime for Python. wasmer_compiler_cranelift provides the Cranelift compiler to wasmer, so that wasmer is able to compile WebAssembly module.

Other compilers exist:

  • wasmer_compiler_llvm,
  • wasmer_compiler_singlepass.

To get a more complete view, please see the documentation of the wasmer package itself.

Install

This package must be used with the wasmer package, thus:

$ pip install wasmer
$ pip install wasmer_compiler_cranelift

Usage

Any engines in wasmer.engine can take the wasmer_compiler_cranelift.Compiler class as argument:

from wasmer import engine, Store, Module, Instance
from wasmer_compiler_cranelift import Compiler

# Let's use the Cranelift compiler with the JIT engine…
store = Store(engine.JIT(Compiler))

# … or with the native engine!
store = Store(engine.Native(Compiler))

# And now, compile the module.
module = Module(store, open('my_program.wasm', 'rb').read())

# Now it's compiled, let's instantiate it.
instance = Instance(module)

# And get fun, for example by calling the `sum` exported function!
print(instance.exports.sum(1, 2))

Documentation

Browse the documentation at https://wasmerio.github.io/wasmer-python/api/wasmer_compiler_cranelift/.

Alternatively, run just build compiler-cranelift followed by just doc to generate the documentation inside docs/api/wasmer_compiler_cranelift.html.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

wasmer_compiler_cranelift_py310-1.0.0-cp310-none-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10 Windows x86-64

wasmer_compiler_cranelift_py310-1.0.0-cp310-cp310-manylinux_2_27_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.27+ x86-64

wasmer_compiler_cranelift_py310-1.0.0-cp310-cp310-macosx_10_7_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10 macOS 10.7+ x86-64

File details

Details for the file wasmer_compiler_cranelift_py310-1.0.0-cp310-none-win_amd64.whl.

File metadata

  • Download URL: wasmer_compiler_cranelift_py310-1.0.0-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for wasmer_compiler_cranelift_py310-1.0.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 87993e4b43ef7ca69c7fc15ed4195e7561a77883db79907c51046056f0b80604
MD5 362250caeec090d36df7c062b7efe7ea
BLAKE2b-256 325c66a31ec4744a89ffcd1e37c3f5650daa39b5be11448d064bc7104eae5090

See more details on using hashes here.

File details

Details for the file wasmer_compiler_cranelift_py310-1.0.0-cp310-cp310-manylinux_2_27_x86_64.whl.

File metadata

  • Download URL: wasmer_compiler_cranelift_py310-1.0.0-cp310-cp310-manylinux_2_27_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for wasmer_compiler_cranelift_py310-1.0.0-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 8dc55d6f6b8debf042d97502652e5048591311813f2db0e50d3b6ba47a21813a
MD5 8be641044d496168a002f236f58625c2
BLAKE2b-256 01386ac2e38f36868c31a417ff5d02ca6dc5606774c110a99aa055859229e5f6

See more details on using hashes here.

File details

Details for the file wasmer_compiler_cranelift_py310-1.0.0-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: wasmer_compiler_cranelift_py310-1.0.0-cp310-cp310-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.10, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for wasmer_compiler_cranelift_py310-1.0.0-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 db21a81e768f3159168f7fcaf466efb09b1748d8cc821cd1062a778e11d5f5bd
MD5 3b69c10f62c93d80c7f70c938db5a7ef
BLAKE2b-256 69498ca8373aa307e21861c4b9871a688a4232d3f8a57e818f1cc8761d529a37

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page