Developer Guide
This is a guide for those who wish to contribute to the MUSE 2.0 project or make local changes to the code.
The API documentation is available here.
Installing the Rust toolchain
We recommend that developers use rustup
to install the Rust toolchain. Follow the instructions on
the rustup
website.
Once you have done so, select the stable
toolchain (used by this project) as your default with:
rustup default stable
As the project uses the latest stable toolchain, you may see build errors if your toolchain is out of date. You can update to the latest version with:
rustup update stable
Working with the project
To build the project, run:
cargo build
Note that if you just want to build-test the project (i.e. check for errors and warnings) without
building an executable, you can use the cargo check
command, which is much faster.
To run MUSE 2.0 with the "simple" example, you can run:
cargo run run examples/simple
(Note the two run
s. The first is for cargo
and the second is passed as an argument to the built
muse2
program.)
Tests can be run with:
cargo test
More information is available in the official cargo
book.
Checking test coverage
We use Codecov to check whether pull requests introduce code without tests.
To check coverage locally (i.e. to make sure newly written code has tests), we recommend using cargo-llvm-cov.
It can be installed with:
cargo install cargo-llvm-cov
Once installed, you can use it like so:
cargo llvm-cov --open
This will generate a report in HTML format showing which lines are not currently covered by tests and open it in your default browser.
Developing the documentation
We use mdBook for generating technical documentation.
If you are developing the documentation locally, you may want to check that your changes render correctly (especially if you are working with equations).
To do this, you first need to install mdBook:
cargo install mdbook
You can then view the documentation in your browser like so:
mdbook serve -o
Pre-Commit hooks
Developers must install the pre-commit
tool in order to automatically run this
repository's hooks when making a new Git commit. Follow the instructions on the pre-commit
website in order to get started.
Once you have installed pre-commit
, you need to enable its use for this repository by installing
the hooks, like so:
pre-commit install
Thereafter, a series of checks should be run every time you commit with Git. In addition, the
pre-commit
hooks are also run as part of the CI pipeline.