Building from Source¶
Prerequisites¶
-
Rust (latest stable)
-
Python 3.10+ with development headers
-
maturin (Rust-Python build tool)
Quick Build¶
git clone https://github.com/txjmb/jsonata-core.git
cd jsonatapy
git submodule update --init --recursive
# Development build
maturin develop --release
# Run tests
pytest tests/python/ -v
Build Commands¶
Development mode (for local testing):
Build wheel:
Build for specific Python version:
Build for multiple Python versions:
Testing¶
Python tests:
# All tests
pytest tests/python/ -v
# Reference suite only
pytest tests/python/test_reference_suite.py -v
# Parallel execution
pytest tests/python/ -n auto
Rust tests:
Development Workflow¶
- Make changes to Rust code
- Rebuild:
maturin develop --release - Test:
pytest tests/python/ -v - Format:
cargo fmt - Lint:
cargo clippy
Platform-Specific Notes¶
Linux¶
For cross-compilation to aarch64:
sudo apt-get install gcc-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
maturin build --release --target aarch64-unknown-linux-gnu
macOS¶
Build for both architectures:
# ARM (native on M1/M2/M3)
maturin develop --release
# Intel (cross-compile on ARM)
rustup target add x86_64-apple-darwin
maturin build --release --target x86_64-apple-darwin
Windows¶
Requires Visual Studio with C++ build tools:
Benchmarks¶
# Python benchmarks
python benchmarks/benchmark.py
# Update performance docs
python benchmarks/update_docs.py
Troubleshooting¶
maturin not found:
Rust compiler errors:
Test failures: