Skip to main content

A WebAssembly runtime powered by Wasmtime

Project description

wasmtime-py

Python embedding of Wasmtime

A Bytecode Alliance project

CI status Latest Version Latest Version Documentation Code Coverage

Installation

To install wasmtime-py, run this command in your terminal:

$ pip install wasmtime

The package currently supports 64-bit builds of Python 3.9+ on Windows, macOS, and Linux, for x86_64 and arm64 architectures.

Versioning

wasmtime-py follows the Wasmtime versioning scheme, with a new major version being released every month. As with Wasmtime itself, new major versions of wasmtime-py can contain changes that break code written against the previous major version.

Since every installed Python package needs to agree on a single version of wasmtime-py, to use the upper bound on the major version in the dependency requirement should be bumped reguarly, ideally as soon as a new wasmtime-py version is released. To automate this process it is possible to use the whitequark/track-pypi-dependency-version script. YoWASP/runtime is an example of a project that automatically publishes releases on PyPI once a new version of wasmtime-py is released if it passes the testsuite.

Usage

In this example, we compile and instantiate a WebAssembly module and use it from Python:

from wasmtime import Store, Module, Instance, Func, FuncType

store = Store()
module = Module(store.engine, """
  (module
    (func $hello (import "" "hello"))
    (func (export "run") (call $hello))
  )
""")

def say_hello():
    print("Hello from Python!")
hello = Func(store, FuncType([], []), say_hello)

instance = Instance(store, module, [hello])
run = instance.exports(store)["run"]
run(store)

Be sure to check out the examples directory, which has other usage patterns as well as the full API documentation of the wasmtime-py package.

If your WebAssembly module works this way, then you can also import the WebAssembly module directly into Python without explicitly compiling and instantiating it yourself:

# Import the custom loader for `*.wasm` files
import wasmtime.loader

# Assuming `your_wasm_file.wasm` is in the python load path...
import your_wasm_file

# Now you're compiled and instantiated and ready to go!
print(your_wasm_file.run())

Components

Components are also supported in wasmtime-py. For more information see the documentation of wasmtime.component. Using a component is similar to using core wasm modules, and for examples see the tests/component/ directory.

Contributing

See CONTRIBUTING.md.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

wasmtime-41.0.0.tar.gz (117.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

wasmtime-41.0.0-py3-none-win_arm64.whl (5.4 MB view details)

Uploaded Python 3Windows ARM64

wasmtime-41.0.0-py3-none-win_amd64.whl (6.3 MB view details)

Uploaded Python 3Windows x86-64

wasmtime-41.0.0-py3-none-musllinux_1_2_x86_64.whl (7.8 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

wasmtime-41.0.0-py3-none-musllinux_1_2_aarch64.whl (6.8 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

wasmtime-41.0.0-py3-none-manylinux2014_aarch64.whl (6.8 MB view details)

Uploaded Python 3

wasmtime-41.0.0-py3-none-manylinux1_x86_64.whl (7.7 MB view details)

Uploaded Python 3

wasmtime-41.0.0-py3-none-macosx_11_0_arm64.whl (6.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

wasmtime-41.0.0-py3-none-macosx_10_13_x86_64.whl (7.5 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

wasmtime-41.0.0-py3-none-any.whl (6.3 MB view details)

Uploaded Python 3

wasmtime-41.0.0-py3-none-android_26_x86_64.whl (7.7 MB view details)

Uploaded Android API level 26+ x86-64Python 3

wasmtime-41.0.0-py3-none-android_26_arm64_v8a.whl (6.8 MB view details)

Uploaded Android API level 26+ ARM64 v8aPython 3

File details

Details for the file wasmtime-41.0.0.tar.gz.

File metadata

  • Download URL: wasmtime-41.0.0.tar.gz
  • Upload date:
  • Size: 117.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wasmtime-41.0.0.tar.gz
Algorithm Hash digest
SHA256 fc2aaacf3ba794eac8baeb739939b2f7903e12d6b78edddc0b7f3ac3a9af6dfc
MD5 90cac3a2053318cf85b9d4c3db137a0a
BLAKE2b-256 be686dc0e7156f883afe0129dd89e4031c8d1163131794ba6ce9e454a09168ad

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-win_arm64.whl.

File metadata

  • Download URL: wasmtime-41.0.0-py3-none-win_arm64.whl
  • Upload date:
  • Size: 5.4 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wasmtime-41.0.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 0c4bcaba055e78fc161f497b85f39f1d35d475f0341b1e0259fa0a4b49e223e8
MD5 daba707049aa5e716959a9abadfb2cf7
BLAKE2b-256 4a4abba9c0368c377250ab24fd005a7a1e9076121778c1e83b1bcc092ab84f86

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: wasmtime-41.0.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wasmtime-41.0.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 4f29171d73b71f232b6fe86cba77526fee84139f1590071af5facba401b0c9eb
MD5 a820829a0beee6a7e72e62ed85d74795
BLAKE2b-256 f49d236bb367270579e4f628fb7b04fe93541151df7953006f3766607fc667c9

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for wasmtime-41.0.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d9627dfc5625b4947ea35c819561da358838fe76f65bda8ffe01ce34df8b32b1
MD5 452b9471e273ff1f078c1ad67bad3b43
BLAKE2b-256 9f094608b65fa35ce5fc1479e138293a1166b4ea817cfa9a79f019ab6d7013d8

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for wasmtime-41.0.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 1dabb20a2751f01b835095013426a76091bd0bdb36ca9bcfc49c910b78347438
MD5 07c729dcff9d98b7fc798e2c48e30e01
BLAKE2b-256 142943656c3a464d437d62421de16f2de2db645647bab0a0153deea30bfdade4

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for wasmtime-41.0.0-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e0ea44584f60dcfa620af82d4fc2589248bcf64a93905b54ac3144242113b48a
MD5 54a3cb490fc268db3255c2e274bf6ef0
BLAKE2b-256 bb48b748a2e70478feabc5c876d90e90a39f4aba35378f5ee822f607e8f29c69

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for wasmtime-41.0.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ad7e866430313eb2ee07c85811e524344884489d00896f3b2246b65553fe322c
MD5 fbb98b6a8c865ef551ec9498784285b0
BLAKE2b-256 bddf0867edd9ec26eb2e5eee7674a55f82c23ec27dd1d38d2d401f0e308eb920

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for wasmtime-41.0.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f475df32ce9bfec4f6d0e124a49ca4a89e2ee71ccca460677f5237b1c8ee92ae
MD5 2c2e6d84ff225789962511b962827db0
BLAKE2b-256 bcf0dcc80973d2ec58a1978b838887ccbd84d56900cf66dec5fb730bec3bd081

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for wasmtime-41.0.0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2107360212fce33ed2adcfc33b7e75ed7136380a17d3ed598a5bab376dcf9e1b
MD5 5f316ddd51e2f6235f0f960225ccec97
BLAKE2b-256 a016d91cb80322cc7ae10bfa5db8cea4e0b9bb112f0c100b4486783ab16c1c22

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-any.whl.

File metadata

  • Download URL: wasmtime-41.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wasmtime-41.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f6721406a6cd186d11f34e6d4991c4d536387b0c577d09a56bd93b8a3cf10c2
MD5 3baaba0cba57ecea4ee33f67f936a5ac
BLAKE2b-256 18ca6cce49b03c35c7fecb4437fd98990c64694a5e0024f9279bef0ddef000f7

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-android_26_x86_64.whl.

File metadata

File hashes

Hashes for wasmtime-41.0.0-py3-none-android_26_x86_64.whl
Algorithm Hash digest
SHA256 4a3e33d0d3cf49062eaa231f748f54af991e89e9a795c5ab9d4f0eee85736e4c
MD5 0fdd009fa7b5a496bd352b5f37dfef33
BLAKE2b-256 04b942ec977972b2dcc8c61e3a40644d24d229b41fba151410644e44e35e6eb1

See more details on using hashes here.

File details

Details for the file wasmtime-41.0.0-py3-none-android_26_arm64_v8a.whl.

File metadata

File hashes

Hashes for wasmtime-41.0.0-py3-none-android_26_arm64_v8a.whl
Algorithm Hash digest
SHA256 f5a6e237b5b94188ef9867926b447f779f540c729c92e4d91cc946f2bee7c282
MD5 c0cfc757bed77e2d8abd7773480b750a
BLAKE2b-256 31f9f6aef5de536d12652d97cf162f124cbdd642150c7da61ffa7863272cdab7

See more details on using hashes here.

Supported by

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