Prerequisites
Before building WAX, ensure you have the following installed:-
Protobuf compiler: Required for generating protocol buffer files
- Git: For cloning the repository and managing submodules
- Python 3.12+: Required for Python builds
- Node.js 20.11+ or 21.2+: Required for TypeScript builds
- pnpm: Package manager for TypeScript
- Poetry 2.1.3: Python dependency management
Building Python
The Python implementation uses Cython bindings compiled to native.so modules.
Install Poetry
First, install Poetry if you haven’t already:Set up build environment
WAX uses a dedicated version of Boost library (statically built). Use the CI base image as your build environment:- Base image: Available at GitLab Container Registry
- Dockerfile:
python/docker/Dockerfile.ci
WAX_BOOST_ROOT with pre-compiled Boost library and supports multiple Python versions.
Build the wheel
From the root project directory, run:- Generate protocol buffer files from the
hivesubmodule - Build API packages from the hived OpenAPI specification
- Compile Cython bindings
- Create a wheel file in the
./distdirectory
Build for specific Python version
The CI pipeline builds for multiple Python versions:Build artifacts
After a successful build, you’ll find:- Wheel file:
python/wax/dist/hiveio_wax-*.whl - Build logs:
python/wax/.build/logs/ - Compiled modules:
python/wax/wax/*.so - Generated proto files:
python/wax/wax/_private/proto/
Building TypeScript
The TypeScript implementation uses WebAssembly (WASM) compiled from C++ via Emscripten.Install dependencies
From thets/ directory:
Build WASM and TypeScript
Build the complete package:- Compile C++ code to WASM using Emscripten
- Generate TypeScript types from protocol buffers
- Compile TypeScript code
- Create a distributable package
Build tests only
To build just the test suite:Build artifacts
After a successful build, you’ll find:- Package tarball:
ts/wasm/dist/*.tgz - WASM artifacts:
ts/wasm/build_wasm/ - Compiled TypeScript:
ts/wasm/dist/lib/ - Generated proto files:
ts/wasm/lib/proto/ - Build logs:
ts/wasm/build_wasm/*.log
Installing from source
Python installation
Create a virtual environment and install:Set the registry environment variables before installing:
Developer installation script
For development, use the installation script:TypeScript installation
Install from the built tarball:Debugging Python builds
For debugging Cython code, use a debug build of Python:CI/CD pipeline
The GitLab CI pipeline automates the build process:Pipeline stages
- prepare: Build CI base images
- build: Build wheels and WASM packages
- static_code_analysis: Run linters and type checkers
- test_python: Run Python tests
- test: Run TypeScript tests
- deploy: Publish packages to registries
- test-tools: Build and test helper tools
Key build jobs
build_wheel: Builds Python wheels for multiple Python versions (3.12, 3.14)wax_wasm_proto_tsc_generation: Builds TypeScript WASM packagehiveio_api_package: Generates API packages from hived OpenAPI specwax_wasm_build_tests: Builds test suitegenerate_docs: Generates API documentation
Build matrix
Python builds run in parallel for multiple versions:Project structure
Troubleshooting
Protobuf compiler not found
Protobuf compiler not found
Install the protobuf compiler:Or on macOS:
Poetry not found
Poetry not found
Ensure Poetry is installed and in your PATH:
Python version mismatch
Python version mismatch
The wheel must match your Python version. Check the wheel filename for the Python tag (e.g.,
cp312 for Python 3.12).Build for your specific Python version:Missing Boost libraries
Missing Boost libraries
Use the official CI base image which includes pre-compiled Boost:
WASM build fails
WASM build fails
Ensure you have initialized the git submodules:Check the build logs in
ts/wasm/build_wasm/*.log for specific errors.Next steps
Running tests
Learn how to run tests and examples
Contributing
Contribute to the WAX project