wasmpy
WebAssembly in Python.
Wasmpy is a lightweight layer that sits between Python and WebAssembly. When attempting to import a WebAssembly file, the file is converted into machine code for native speeds.
Installing
python3 -m pip install wasmpy
Usage
To get started, first import the wasmpy module to register the WebAssembly import hooks.
Then you can just import wasm_or_wat_file to load a WebAssembly module.
Usage with Python modules
|- my_module
|- __init__.py
|- wasm_math.wat
# __init__.py
import wasmpy
from .wasm_math import add
;; wasm_math.wat
(module
(func (export "add") (param i32 i32) (result i32)
(i32.add (local.get 0) (local.get 1))
)
)
>>> import my_module
>>> my_module.add(45, 960)
1005
>>>
Invalid function names
Functions exported from WebAssembly can also be accessed from the module by using their name as a key.
For exported names that aren't valid Python identifiers or which start with a _, this is the only valid way of accessing these functions.
;; wasm_math.wat
(module
(func (export "add one") (param i32) (result i32)
(i32.add (local.get 0) (i32.const 1))
)
)
>>> import wasmpy
>>> import wasm_math
>>> wasm_math["add one"](11)
12
>>>
Building From Source
On Windows this requires the mingw-w64 as tool to be on PATH.
git clone https://github.com/olivi-r/wasmpy.git
cd wasmpy
python3 setup.py assemble
python3 -m pip install .
Limitations
Wasmpy is still in active development, and only supports x86/x86-64 Windows and Linux machines and lacks some key features:
- most memory instructions
- most control instructions
- imports
- tables
Goals
-
Current target:
- Reach compatability with the MVP
-
Future Goals
- Native support for more architectures, particularly those supported by manylinux
- Interfacing with the Python C API from WebAssembly (in conjunction with the Wasmpy sister project wasmpy-build) to allow compiled extension modules that are platform independent
- Compatibility with Pyodide
- Python implementation support for Jython, PyPy etc.
- Support for WebAssembly proposals
- Support for WASI snapshots, as well as support for supersets such as WASIX
Metadata
Release files for wasmpy 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wasmpy-0.2.3.tar.gz | 52.2 kB | Without provenance | Details for wasmpy-0.2.3.tar.gz |
Built distributions (wheels)
Total release size: 3.3 MB
Release files / wasmpy-0.2.3.tar.gz
| Download URL | wasmpy-0.2.3.tar.gz |
|---|---|
| Size | 52.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f65c625fc4a88fab978ac6f6915bd6495c3c86cb95c3f32c615ee3189ce7f1a
|
|
BLAKE2b-256 checksum How to use checksums |
24eb563e5b04176ce2d778976d6f660153bdae348a501bfa0dd1d24078a76d3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.16
|
Release files / wasmpy-0.2.3-cp36-abi3-win_amd64.whl
| Download URL | wasmpy-0.2.3-cp36-abi3-win_amd64.whl |
|---|---|
| Size | 55.4 kB |
| Tags | CPython 3.6 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
993c540f45405f40e1d3dfe18b991596bb1e9b44d88817980c0b5f476bce66a7
|
|
BLAKE2b-256 checksum How to use checksums |
50b97af764e3a745bfacd85da3890bb830ebc381507fb96980c0945b0eb0d4bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.5
|
Release files / wasmpy-0.2.3-cp36-abi3-win32.whl
| Download URL | wasmpy-0.2.3-cp36-abi3-win32.whl |
|---|---|
| Size | 50.0 kB |
| Tags | CPython 3.6 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
b2e3a2016c13b768fe75a09acc26647ebac07b6cdcbc68b32166d0a61c47eee4
|
|
BLAKE2b-256 checksum How to use checksums |
aa2693df4307a9fe135f91db35caecc7dde6f318808f4a39e1064a22c65aca34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.5
|
Release files / wasmpy-0.2.3-cp36-abi3-musllinux_1_1_x86_64.whl
| Download URL | wasmpy-0.2.3-cp36-abi3-musllinux_1_1_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.6 Linux musl 1.1+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c05a6f5c2439efc3679f7d105cf4ee36307604fbadfae1a244156eeca9f33ad9
|
|
BLAKE2b-256 checksum How to use checksums |
a11efc3ab6422e8d189263c0949737b64c92d7106abd84e0b13ad7f6d6ca97aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.16
|
Release files / wasmpy-0.2.3-cp36-abi3-musllinux_1_1_i686.whl
| Download URL | wasmpy-0.2.3-cp36-abi3-musllinux_1_1_i686.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.6 Linux musl 1.1+ x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
ddf1c9e1b01ea657e7363879e9525a9619057b91407e94fded29ab28e6c7ce9b
|
|
BLAKE2b-256 checksum How to use checksums |
cd59fe75e2da146f59822da1f58a0b8a3abfdbfba86eeadd06b09a85720b5a6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.16
|
Release files / wasmpy-0.2.3-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | wasmpy-0.2.3-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 556.1 kB |
| Tags | CPython 3.6 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5525fe0c5f2b7a54549b6c125790025ad8255aa09b4d3d1c6724f39b28115bd7
|
|
BLAKE2b-256 checksum How to use checksums |
21332c2a40a25e1e969cdbecc7ae9bdefefbcd4eaadc746ad461298502d72bac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.16
|
Release files / wasmpy-0.2.3-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | wasmpy-0.2.3-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 460.4 kB |
| Tags | CPython 3.6 Linux glibc 2.12+ x86-32 Linux glibc 2.17+ x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
e1cecc37f2b31c356bf17c20a48e1fe0f1b48ade089f8c5372353c8fb6dbd3b1
|
|
BLAKE2b-256 checksum How to use checksums |
3fe0df6b460f661c84da2b5993a7d40985024bab6efafc7689c078dc13c5e54f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.16
|
Security for wasmpy 0.2.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.