Thank you for your interest in contributing! This guide will help you get set up for development.
The build process requires several tools to be installed:
-
Python 3.12+
python --version # Should be 3.12 or higher -
uv - Python package manager
-
Rust toolchain (stable)
-
wasm32-unknown-unknown target (required by build.rs)
rustup target add wasm32-unknown-unknown
-
wasm-tools (required by build.rs for WIT merging and componentization)
-
Viceroy - Fastly's local testing server
-
Clone the repository
git clone <repo-url> cd compute-sdk-python/build-tool-impl
-
Initialize submodules (if applicable)
git submodule update --init --recursive
-
Install Python dependencies
uv sync --extra dev --extra test -
Verify setup
make help # Should show available commands
The default development workflow uses cargo run which automatically picks up Rust changes:
# Build an example
make build/bottle-app.composed.wasm
# Build all examples
make
# Serve an example for testing
make serve EXAMPLE=bottle-appThe build tool is in crates/fastly-compute-py/. When you make changes:
# The build system automatically rebuilds via `cargo run`
make build/bottle-app.composed.wasm
# Or test the installed entry point
make DEV_MODE=0 build/bottle-app.composed.wasm# Format code (Python + Rust)
make format
# Check formatting
make format-check
# Run linters (Python + Rust)
make lint
# Auto-fix linting issues
make lint-fix# Run all tests
make test
# Update snapshot tests
make test-update-snapshots.
├── crates/
│ ├── fastly-compute-py/ # Rust build tool
│ │ ├── build.rs # Build script (requires wasm-tools)
│ │ └── src/
│ └── wasiless/ # WASM component for WASI removal
├── examples/ # Example applications
│ ├── bottle-app/
│ ├── flask-app/
│ └── ...
├── fastly_compute/ # Python SDK
├── wit/ # WIT (WebAssembly Interface Type) definitions
└── tests/ # Integration tests
Understanding the build process helps when debugging issues:
-
build.rs runs (during Rust compilation):
- Calls
wasm-tools component witto merge WIT files - Builds
wasilesscrate for wasm32-unknown-unknown - Calls
wasm-tools component newto componentize wasiless
- Calls
-
fastly-compute-py runs:
- Resolves Python dependencies from virtualenv
- Calls
componentize-pyto build Python WASM component - Composes with wasiless using WAC
Our CI builds wheels for multiple platforms:
- Linux: x86_64, aarch64
- macOS: x86_64 (Intel), aarch64 (Apple Silicon)
- Windows: x86_64
The CI workflow (.github/workflows/build-wheels.yml) ensures all required tools are installed automatically.