A simple CLI for WebAssembly component workflow.
- Python
- Go
- Rust
- JavaScript
- C/C++
- Quickstart
- Manual installation
- Using Docker
- Usage
- Available Commands
- Formatting and linting
- Running tests
- Install everything automatically
make installThis will:
- Install system packages (via
apt-get) - Install Go 1.24.3
- Install Rust (via
rustup) - Install TinyGo 0.37.0
- Install Python packages from
requirements.txt - Install WASM tools (
wkg,wasm-tools,cargo-component) - Install Node.js 22.x and JS tools (
jco,componentize-js)
- Verify your setup
make checkRuns both:
make system-check— checks Go, Rust, TinyGo, Node.js, Python, clang (wasi-sdk)make sdk-check— checks installed CLI tools (jco,wkg,wasm-tools,cargo-component) and Python packages
- Build your project
make buildIf you prefer to install dependencies manually, follow these steps.
sudo apt-get update
sudo apt-get install -y \
build-essential ca-certificates cmake curl git gnupg \
lld llvm patchelf python3 python3-dev python3-pip wgetwget https://go.dev/dl/go1.24.3.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.24.3.linux-amd64.tar.gz
rm go1.24.3.linux-amd64.tar.gz
export PATH="/usr/local/go/bin:$PATH"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"wget https://github.com/tinygo-org/tinygo/releases/download/v0.37.0/tinygo_0.37.0_amd64.deb
sudo dpkg -i tinygo_0.37.0_amd64.deb
rm tinygo_0.37.0_amd64.debpython3 -m pip install --upgrade pip
python3 -m pip install --no-cache-dir -r requirements.txtcargo install --locked --root /usr/local wkg --version 0.10.0
cargo install --locked --root /usr/local wasm-tools
cargo install --locked --root /usr/local cargo-component --version 0.21.1curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejsnpm install -g @bytecodealliance/jco@1.9.1 \
@bytecodealliance/componentize-js@0.7.0wget -q https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.deb
sudo apt install -y ./wasi-sdk-25.0-x86_64-linux.deb
rm wasi-sdk-25.0-x86_64-linux.deb
# Add /opt/wasi-sdk/bin to PATH
export WASI_SDK_PATH=/opt/wasi-sdk
export PATH=$WASI_SDK_PATH/bin:$PATHYou can avoid installing all dependencies locally by using the official Docker image:
docker pull mandeser0/tarawasm:latestAdd this alias to your shell config (~/.bashrc or ~/.zshrc):
alias tarawasm='docker run --rm -v "$PWD":/work -w /work mandeser0/tarawasm'When working on Python-based components, the base Docker image may not include all Python libraries you need. If you encounter missing dependencies, you can install them directly inside the container using:
tarawasm pip install <your-package>This will run pip install inside the Docker container, making the package available for subsequent tarawasm build commands.
Before starting, you need WIT definitions. Example:
wkg wit build --wit-dir=<path-to-your-wit-files>Move the resulting .wasm file into your project directory.
tarawasm init --lang <language> --wasm-file <your-wasm-file> <world-name>You can optionally specify a custom source file:
tarawasm init --lang <language> --wasm-file <your-wasm-file> \
--src-file <your-source-file> <world-name>tarawasm bindtarawasm build| Command | Description |
|---|---|
tarawasm init |
Initialize project and save config |
tarawasm bind |
Generate bindings from WIT |
tarawasm build |
Compile source to WASM component |
tarawasm clean |
Remove build artifacts |
tarawasm all |
Run clean, bind, and build |
tarawasm strip |
Remove custom sections from the WASM binary |
The
stripcommand helps reduce the size of the generated WASM component by removing unnecessary custom sections. This is especially useful for Python-based components, where it can reduce the final binary size by up to 2x.
To install development dependencies and set up pre-commit hooks:
python3 -m pip install -r requirements-dev.txt
pre-commit installRun Ruff for code style checks:
ruff .Run Black for formatting:
black .Or run all pre-commit hooks:
pre-commit run --all-filesThe test suite mirrors the Docker workflow and requires a WebAssembly runtime.
Set the WASM_RUNTIME environment variable to your runtime binary (defaults to wasmtime):
export WASM_RUNTIME=wasmtimeTests for the C example will only run if clang --version reports the wasm32-unknown-wasi target (see WASI SDK).
Run tests:
pytest