Universal WASM loader for Python
Project description
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
from universal_wasm_loader import wasm_import, create_singleton, InstancePool
exports = await wasm_import("./math.wasm")
result = exports["calculate"](1, 2) # 3
See CLAUDE.md / cmem/overview.md for the full API surface.
Develop
pixi run test # pytest tests/ -v
pixi run lint # ruff check src/ tests/
pixi run typecheck # mypy src/
Release / publish to PyPI
The version lives in pyproject.toml [project] version — the single source of truth
(pixi.toml mirrors it). Three scripts key off it, each shipped in two equivalent forms: a
Bash .sh and a cross-platform Nushell .nu (Nushell ≥ 0.113; runs on Windows/macOS/Linux
without Git Bash). Use whichever your machine has — they have identical flags and behavior.
Tagging/releasing and publishing are deliberately decoupled: release tags + pushes +
creates the GitHub Release; publish is a separate, auth-gated, confirmation-guarded step that
actually uploads to PyPI (irreversible). All three support --dry-run.
# 1) Bump the version (commits the isolated change)
bash scripts/bump-version.sh patch # 1.0.0 -> 1.0.1 (or minor | major | X.Y.Z)
nu scripts/bump-version.nu patch # …equivalent
# 2) Tag v<version>, push branch + tag, create the GitHub Release (NO PyPI upload)
bash scripts/release.sh # --no-release / --no-build / --remote / --dry-run
nu scripts/release.nu
# 3) Publish to PyPI — separate, deliberate, irreversible
bash scripts/publish.sh # prompts; --yes / --dry-run / --allow-dirty / --skip-tag-check
nu scripts/publish.nu
publish reads the version from pyproject.toml, requires the matching v<version> tag to
exist locally and on the remote, refuses to run without a PyPI token, and is idempotent (if
that version is already on PyPI it reports success and uploads nothing).
Required setup for publish (one-time)
-
PyPI project owned/registered. The name
universal-wasm-loadermust exist on PyPI under an account you control (do the first upload, or pre-register the name). -
A PyPI API token in the environment (project-scoped is best):
export TWINE_USERNAME=__token__ export TWINE_PASSWORD=pypi-XXXXXXXX # your token; or a [pypi] entry in ~/.pypirc
Publishing from CI instead (optional, token-free)
.github/workflows/publish.yml can also build + upload, but it is manual-only
(workflow_dispatch) — it does not fire on a tag push, so it never double-publishes
alongside release. Run it from the Actions tab against the release tag.
It authenticates with PyPI Trusted Publishing over short-lived OIDC — no long-lived PyPI token
is stored in repo secrets, so there's nothing to leak. One-time setup: register a Trusted
Publisher on PyPI (a pending publisher before the project's first upload) with Owner
jrmarcum, Repository universalWasmLoader-py, Workflow publish.yml.
run:-only workflow. This org's GitHub Actions policy permits onlyjrmarcum-owned actions; any third-partyuses:step (includingactions/checkoutandpypa/gh-action-pypi-publish) causes astartup_failure. The workflow therefore uses plainrun:steps throughout — including the OIDC exchange (ACTIONS_ID_TOKEN_REQUEST_*→https://pypi.org/_/oidc/mint-token→twine uploadwith the ephemeral token), done by hand rather than via the pypa publish action.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file universal_wasm_loader-1.0.0.tar.gz.
File metadata
- Download URL: universal_wasm_loader-1.0.0.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b6629e9dfaad0d12cc6668240871d2aba5c6701c63855077bb3b7c1e5174e5
|
|
| MD5 |
4911b975a0de12ebf488bcbf67b00bd3
|
|
| BLAKE2b-256 |
8e8665ed9609bb2dc9cc2ab8673feeb6ca19dc1a1a4c5e376dc4fee67777611d
|
File details
Details for the file universal_wasm_loader-1.0.0-py3-none-any.whl.
File metadata
- Download URL: universal_wasm_loader-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74cd3f55cf7bbe1ac7afc018cd9841a234d53bb36e5045d791ed0e73a133b369
|
|
| MD5 |
5cbedfd63c5f0b069c16bce2e5d41222
|
|
| BLAKE2b-256 |
bc644f3b6449d3f47bdc49496bcf6e1b759b7239188b4a473693bc227f38af6e
|