Skip to main content

wasmpy-build

appveyor-build

This tool can compile CPython C extension files, such as the ones created by Cython, to WebAssembly so that the extensions are platform independent.

Currently supports CPython 3.6 to 3.12.

wasi-sdk is automatically downloaded on first use.

Usage

Wasmpy-build can be easily integrated into an existing project by the use of a drop-in build_ext override:

From a pyproject.toml file

This uses an experimental feature and may not work verbatim in the future.

[build-system]
requires = ["setuptools", "wasmpy-build"]
build-backend = "setuptools.build_meta"

[project]
# ...

[tool.setuptools.cmdclass]
build_ext = "wasmpy_build.build_ext"

[[tool.setuptools.ext-modules]]
name = "mymodule"
sources = ["mymodule.c"]

From a setup.py script

from wasmpy_build import build_ext
from setuptools import setup, Extension

setup(
    ext_modules=[Extension("mymodule", ["mymodule.c"])],
    cmdclass={"build_ext": build_ext},
)

This also works with generated sources, like from Cython:

from Cython.Build import cythonize
from wasmpy_build import build_ext
from setuptools import setup, Extension

setup(
    ext_modules=cythonize([
        Extension("mymodule", ["mymodule.pyx"])
    ]),
    cmdclass={"build_ext": build_ext},
)

From the command line

C

wasmpy-build my_file.c -o my_file.wasm

C++

wasmpy-build++ my_file.cpp -o my_file.wasm

or

wasmpy-build-cpp my_file.cpp -o my_file.wasm

Installation

Install with pip

pip install wasmpy-build

Build from source

git clone --recurse-submodules https://github.com/olivi-r/wasmpy-build
cd wasmpy-build
python generate.py
python -m pip install .

Metadata

Release files for wasmpy-build 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 wasmpy-build 1.1.0
File Size Uploaded Provenance Actions
wasmpy_build-1.1.0.tar.gz 2.3 MB Without provenance Details for wasmpy_build-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wasmpy-build 1.1.0
File Interpreter ABI Platform Actions
wasmpy_build-1.1.0-py3-none-any.whl Python 3 none any Details for wasmpy_build-1.1.0-py3-none-any.whl

Total release size: 5.1 MB

Release files / wasmpy_build-1.1.0.tar.gz

Download URL wasmpy_build-1.1.0.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
dab11964e9695dec13f0f3fa8e1ae6e4928bc756d16ee40c9a4c8573a37f7217
BLAKE2b-256 checksum
How to use checksums
ca2c8ce2fd64d14f92feef93365a31d2a11cf273829338dcd38fdeb2e703c398
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

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

Download URL wasmpy_build-1.1.0-py3-none-any.whl
Size 2.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
9f08e69dc678b484261c88d5568c753b0d30005c9a3b79ccf6576daa0bda6726
BLAKE2b-256 checksum
How to use checksums
b3fc0ea75b4bc0d9e5fa3f42061a759b243cd1ca1b3ceb1634c7afa39c023c1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for wasmpy-build 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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