Skip to content

Latest commit

 

History

History
45 lines (28 loc) · 1.9 KB

README.md

File metadata and controls

45 lines (28 loc) · 1.9 KB

wasi-wheels

Compile Python wheels for use with WASI targets. Specifically, generate wheels that can be consumed by componentize-py.

This is very much a work in progress. The goal is to get to a point where wheels are built and stored as GitHub releases, and provided through an alternate Python package registry for WASI builds until PyPi supports them natively.

Right now this tooling can:

  • Setup the necessary build tooling
  • Download an sdist build for a given project and version
  • Build wheels for pydantic
  • Upload wheels to GitHub
  • TODO: Have a registry for installation

Use a wheel

If you want to use a wheel for use with componentize-py, you can run the following:

pip3 install --target wasi_deps --only-binary :all:  --platform any --python-version "3.12" https://github.com/benbrandt/wasi-wheels/releases/download/pydantic-core/v2.27.2/pydantic_core-2.27.2-cp312-cp312-wasi_0_0_0_wasm32.whl

Then you can run your componentize-py build like so:

componentize-py -w world componentize skill_module -o output_file -p . -p wasi_deps

Setup

Make sure you have python3.12 and rustup installed.

After cloning the repo, you can run:

cargo run -- install-build-tools

This will setup the latest version of WASI SDK with some minor patches for compiling CPython (mainly making wasip2 look like wasi for now, until better support for the correct target is available).

It will also install and compile a fork of Cpython that can be compiled for WASI targets with socket and dynamic linking support.

This is important, because the target of these wheels is componentize-py which expects support for both of these.

Building a wheel