This guide details how to set up your development environment as a SpatialBench contributor.
Your first step is to create a personal copy of the repository and connect it to the main project.
Fork the repository
Clone your fork
sedona-spatialbench.YourUsername with your actual GitHub username.git clone https://github.com/YourUsername/sedona-spatialbench.git cd sedona-spatialbench
Configure the remotes
# Add the main repository as the "upstream" remote git remote add upstream https://github.com/apache/sedona-spatialbench.git
Verify the configuration
git remote -v
origin https://github.com/YourUsername/sedona-spatialbench.git (fetch) origin https://github.com/YourUsername/sedona-spatialbench.git (push) upstream https://github.com/apache/sedona-spatialbench.git (fetch) upstream https://github.com/apache/sedona-spatialbench.git (push)
SpatialBench is written in Rust and is a standard cargo workspace. You can install a recent version of the Rust compiler and cargo from rustup.rs.
To run tests:
cargo test
A local development version of the CLI can be run with:
cargo run --bin spatialbench-cli
Debugging Rust code is most easily done by writing or finding a test that triggers the desired behavior and running it using the Debug selection in your IDE with the rust-analyzer extension.
When debugging the SpatialBench CLI, you can enable verbose output to see detailed logging:
Enable verbose output (info level logging),
cargo run --bin spatialbench-cli -- --scale-factor 1 --verbose
Or using environment variables for more granular control,
RUST_LOG=debug cargo run --bin spatialbench-cli -- --scale-factor 1
The --verbose flag sets the log level to info and ignores the RUST_LOG environment variable. When not specified, logging is configured via RUST_LOG.
You can control logging granularity using RUST_LOG:
# Show only errors RUST_LOG=error cargo run --bin spatialbench-cli -- --scale-factor 1 # Show warnings and errors RUST_LOG=warn cargo run --bin spatialbench-cli -- --scale-factor 1 # Show info, warnings, and errors RUST_LOG=info cargo run --bin spatialbench-cli -- --scale-factor 1 # Show debug output RUST_LOG=debug cargo run --bin spatialbench-cli -- --scale-factor 1 # Show trace output (very verbose) RUST_LOG=trace cargo run --bin spatialbench-cli -- --scale-factor 1 # Show debug output for specific modules RUST_LOG=spatialbench=debug cargo run --bin spatialbench-cli -- --scale-factor 1
We use cargo to run the Rust tests:
cargo test
You can run tests for a specific crate:
cd spatialbench
cargo test
Install pre-commit. This will automatically run various checks (e.g., formatting) that will be needed to pass CI:
pre-commit install
Additionally, you should run clippy to catch common lints before pushing new Rust changes. This is not included in pre-commit, so this should be run manually. Fix any suggestions it makes, and run it again to make sure there are no other changes to make:
cargo clippy
To contribute to the SpatialBench documentation:
pip install -r docs/requirements.txt
mkdocs serve - Start the live-reloading docs server.mkdocs build - Build the documentation site.mkdocs -h - Print help message and exit.