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-40.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-40.0.0-py3-none-win_arm64.whl (5.4 MB view details)

Uploaded Python 3Windows ARM64

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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

wasmtime-40.0.0-py3-none-musllinux_1_2_aarch64.whl (6.9 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3

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

Uploaded Python 3

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

Uploaded Python 3macOS 11.0+ ARM64

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

Uploaded Python 3macOS 10.13+ x86-64

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

Uploaded Python 3

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

Uploaded Android API level 26+ x86-64Python 3

wasmtime-40.0.0-py3-none-android_26_arm64_v8a.whl (6.9 MB view details)

Uploaded Android API level 26+ ARM64 v8aPython 3

File details

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

File metadata

  • Download URL: wasmtime-40.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-40.0.0.tar.gz
Algorithm Hash digest
SHA256 48417c59f13be145184cff61fef61bb52556ea0e7417c25bec09af2d859745ab
MD5 b8507655d1f9f4f2ad3392eef8be8ca5
BLAKE2b-256 ab963e7e9b4c5b9d3071b469502d0c4418d1492e5ce52bbf5b985703b08c6892

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wasmtime-40.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-40.0.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 7667966236bba5e80a1c454553e566a1fa700328bc3e65b5ca970bee7e177e57
MD5 29e163778831d34714dc2f2ae78e0a6e
BLAKE2b-256 d28735cbfdf9619c958a8b48f2ad083b88abc1521d771bfab668002e4405a1da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wasmtime-40.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-40.0.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ebce72e82d1d18726ce3e769094fd8b1d9fc9a1d310cd87c6a85d3ce48fa6567
MD5 767ab1a112d49af87d037bcab9a2f17d
BLAKE2b-256 85be2f81a31430f02f57602ae1b4ff0e369b3cbd07c2fcdd0b696b75e9bfc30a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-40.0.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fee1be5dea191e8350db2e00ff0e57205b9c2d552c6537d736c5c9c75b1470da
MD5 db2952a6174b2b41446ed5290caaf3a6
BLAKE2b-256 9f60c9300d1146f577847aab879ec90d9da3bc7e20f62150386f08adc4aacf41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-40.0.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 504a903099b0518d589db5c17ee6c95b207392c58a272081dc59c33d7000d11f
MD5 2e55f0e0b69b4a054843ade1ff01f1d0
BLAKE2b-256 be9f401934f38c6a6559d2be12180793f18c7c726938a1d207fcfc20a8d4091b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-40.0.0-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3e711b1049ac95f5f34c945b827311c5d382236af5e535a880a26b8861e85aae
MD5 2e86cd299cb0a257e612da067fbfa6b6
BLAKE2b-256 a8d2d6f1b1f22da240c14bc60459677fbc13cd630260a2c5eac9737dbde63bb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-40.0.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d1ad1be984bea3f2325e67258bc9d6d2d4520cfdbcc3b0ae752c8b4817d0212c
MD5 5e71af4f94fd414b977a644e34094a0f
BLAKE2b-256 01bb8f6dd6a213706a101c7c598609015648fbd82bd34455cabdec300c304d8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-40.0.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd2d37071c493377b7c4b27e5d1fe2154f4434fbb6af70f1dce9969f287dac62
MD5 2d5a7f9de29c2571ef0fa293cec7b462
BLAKE2b-256 2c5fef035900032a5012aad368017abf2a7b626aed38b31e8f35c3266a3a3676

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-40.0.0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e2f374948982a749e5c64de04d1a322ecc79ffd633e0f269c47567c3834c4836
MD5 86a1e46b48e1c66d5b5f418ac035a83c
BLAKE2b-256 643310a68779d53557a7d441b40106a7ea0085e9b0af9d82466082cafa890258

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wasmtime-40.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-40.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7532706094f768fcab15fa0cf8c57278f7bc2770a32a74b98e3be7db0984e56
MD5 523767dbd6615b2982d6f4a1afef96ab
BLAKE2b-256 acfa4d061d3b54d8b550c1a043d197380dd54fb1954c58363b914c061fa7a86e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-40.0.0-py3-none-android_26_x86_64.whl
Algorithm Hash digest
SHA256 b462e868f9af4bc69ee353e2cebb3ea5c14984f07b703e3dfc208697ac798fc9
MD5 c2d9d229bbaad6f22d6cc20ebb423d21
BLAKE2b-256 bf202d6afa0e102e85745a3f637e399151f725e836e91c1cd8304bf8cda6eb8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wasmtime-40.0.0-py3-none-android_26_arm64_v8a.whl
Algorithm Hash digest
SHA256 f81dcd8850c66bbe8da53774515bd255a18fce595899e9d851f9969d48d7f592
MD5 866db1ccde6223623a8f16e2412853c4
BLAKE2b-256 2c19da6935d495d5bf5a1defa261c183af3e624b6684bfe8d54a0aa4caf238b6

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