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-39.0.0.tar.gz (117.3 kB view details)

Uploaded Source

Built Distributions

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

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

Uploaded Python 3Windows ARM64

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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3

wasmtime-39.0.0-py3-none-manylinux1_x86_64.whl (7.8 MB view details)

Uploaded Python 3

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

Uploaded Python 3macOS 11.0+ ARM64

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

Uploaded Python 3macOS 10.13+ x86-64

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

Uploaded Python 3

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

Uploaded Android API level 26+ x86-64Python 3

wasmtime-39.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-39.0.0.tar.gz.

File metadata

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

File hashes

Hashes for wasmtime-39.0.0.tar.gz
Algorithm Hash digest
SHA256 30a27221b3fac84bc6247b34339ff6f417b989728513fa4b957a26742651ff7c
MD5 0508c87abfd09cd34412d15e7aa3616c
BLAKE2b-256 297cda1dff86d6d66cd95ab17241e6aa3aef5f8fb316eec8fb956ca23c000347

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wasmtime-39.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-39.0.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 d4254bae165b71d1dd344dbec3b465206467319d17220d60b3efefb72a5483a8
MD5 6de1c6f1d0222f39c077e0fc1079e300
BLAKE2b-256 86c14ac0e00183cce085e44ea0cf78f628c9ef33cb8f9bf8fe6f97e3118be4b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wasmtime-39.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-39.0.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b3db32e65660bc3f245636b2919455af69bd8e754458bc18a5126565b0cd3d9a
MD5 736d3c3e73d28602cdbad666a3d16fe7
BLAKE2b-256 204024af9eab59a4169f390e3e00b09998943bf22ee2f67eca4e7b11560601d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-39.0.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 adb94db5b013ebcbd27fb891015de22e21352c5a7a3b28d3d08fc627bdb082f4
MD5 c1a6923f002aecb58d4f076313e446f0
BLAKE2b-256 e0ce576077a17e48f6645943c7c607ac22b9d51521261a6dafa7881a9a151506

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-39.0.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 e82d4b1a406cd34c19bd3c531084347f0fc7a0b4b4393530e833c9eaad459bbc
MD5 361f3662e98aa01241588032545bbaf5
BLAKE2b-256 26b193745d0d3b5d1a1481f9826f530d03e2f338c4e7d5cfe21857bddd114d97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-39.0.0-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b1572becb900e50f63c604fba53d10ce58877d122c802f6302e07dbcb4dd8ca6
MD5 0f5e5e65b0212fe01c48d337ad540db2
BLAKE2b-256 eb0349284533cb9331f3d906de80893e5750b661cd45e1923b5628da4abe45c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-39.0.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bc5a9dfeeb692877bb5c38439e11253d1553a9d2631e8421552f9bba04af6360
MD5 f97256f586b16124244a86264507a6c7
BLAKE2b-256 52caeaa71d487fe87d342d26de5186587a31fc978ed42d8c44087cf45351b528

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-39.0.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 24525b09e077f67311310503b0e5d08d9887f4eb79ac1b9ffe5cb5c348f8a412
MD5 21024094c4065ced6e5a8cbc873e22e3
BLAKE2b-256 9b56211bb7b1eeb949406854ae22d838d4ffab97e683958420dd08369394933b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-39.0.0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 78bd4965b66d98ffae444784fcd70c0390c59fb0a04813c5526731a8bc80c029
MD5 607c88ee1d95bce2a7f1f5b1afd3c63a
BLAKE2b-256 7d851c53a16c39de3dbcfa70342d3550e162bc5fa347ab5eb8c55478d40b5702

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wasmtime-39.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-39.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5e60ffb196bac6e96f4f7c796aa592e647179ff8aa7da97b3c77a40a59dfde7
MD5 bd05e6f3eea45f41f4ab0c43b9396485
BLAKE2b-256 5a6948abeb238baa42e7cfc41fc3e67676130804842e7269169af963d91d02f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-39.0.0-py3-none-android_26_x86_64.whl
Algorithm Hash digest
SHA256 1b699b59a443f4688b49f2e4d19895b08783ca1a0151c4009e5fa6e06766c869
MD5 01e0addb7067fe78b46241a8adc7e1e7
BLAKE2b-256 da1c8bef06fc7c0ab4c521f5f3864f362ddde99294cfcca21bb621a8d7b61241

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-39.0.0-py3-none-android_26_arm64_v8a.whl
Algorithm Hash digest
SHA256 8ddd8905b7786b791bae5413d86c42e89e2f846bdbc66b307a1d56841bf97b2b
MD5 9c37b3aa78974a8e42b56158ae8b9e58
BLAKE2b-256 bd2d820cc89e430e97bc2760b96f2728feb049ec625bbcf0ec1be9c949f65019

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