Skip to main content

universalWasmLoader-py

Universal WASM loader for Python — the Python port of universalWasmLoader-js. Loads and instantiates WebAssembly modules and, when a companion .wit file is present, applies the Canonical ABI so you call WIT exports with idiomatic Python values (int/float, bool, str) instead of raw i32/pointer pairs.

  • PyPI package: universal-wasm-loader
  • WASM runtime: wasmtime ≥ 26.0.0
  • License: MIT

Install

pip install universal-wasm-loader

Usage

wasm_import() loads a .wasm module and hands you its exports as a dict of ready-to-call Python functions — pull one out, bind it to a name, and call it like any other function:

import asyncio
from universal_wasm_loader import wasm_import

async def main():
    # Load the module. Exports come back as a dict of callables.
    exports = await wasm_import("./math.wasm")

    # Turn a WASM export into a Python function and call it.
    # (companion math.wit -> `calculate: func(a: s32, b: s32) -> s32`)
    calculate = exports["calculate"]
    print(calculate(1, 2))        # 3

asyncio.run(main())

When a companion <name>.wit sits next to the .wasm, the Canonical ABI is applied automatically: kebab-case WIT names become camelCase keys, and arguments and results are idiomatic Python values (bool, str) — no manual i32/pointer handling:

# strings_50.wasm + strings_50.wit -> greet, shout, str-len
exports = await wasm_import("./strings_50.wasm")

greet = exports["greet"]
print(greet("World"))             # "Hello, World!"   (str in, str out)
print(exports["strLen"]("hello")) # 5                 (WIT export `str-len`)

create_singleton() (one shared instance) and InstancePool() (N instances for concurrent workloads) are also exported. See the project on GitHub for the full API, examples, and source.

Metadata

Release files for universal-wasm-loader 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for universal-wasm-loader 1.1.0
File Size Uploaded Provenance
universal_wasm_loader-1.1.0.tar.gz 12.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for universal-wasm-loader 1.1.0
File Interpreter ABI Platform
universal_wasm_loader-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / universal_wasm_loader-1.1.0.tar.gz

Download URL universal_wasm_loader-1.1.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b79cb197f57b579a8a7a649e4e59bc335159c061744a88970b93bf8e0b6d3621
BLAKE2b-256 checksum
How to use checksums
34aa4137f67b246c0c8beb29858c0fc62c796982db02a042f1fe1d033d27e0f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / universal_wasm_loader-1.1.0-py3-none-any.whl

Download URL universal_wasm_loader-1.1.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07d04939d20bf1843dc8c0ebcad80950ec3ba9384ed40926faaab2c57ed04ac5
BLAKE2b-256 checksum
How to use checksums
09c3b03d35c8f929db8f782360de1a0d1745dbb578a44c1da6212bcea70fded7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.3

Security for universal-wasm-loader 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page