- Install Rust via rustup (the pinned toolchain version will be installed automatically from
rust-toolchain.toml) - Ensure you have a C/C++ compiler and
libclanginstalled (required for building the vendored C library and generating FFI bindings) - Clone the repository with submodules:
git clone --recurse-submodules https://github.com/fg-labs/primer3-rs.git
cd primer3-rs- Install git hooks:
./scripts/install-hooks.shThree cargo aliases are defined in .cargo/config.toml to match what CI runs:
cargo ci-fmt # Check formatting (rustfmt)
cargo ci-lint # Run clippy with strict settings (pedantic, warnings as errors)
cargo ci-test # Run all testsRun all three before submitting a PR.
The primer3 C library source lives in the primer3-sys/vendor/primer3 git submodule. To bump to a new upstream version:
cd primer3-sys/vendor/primer3
git fetch && git checkout <ref>
cd ../../..
cargo package -p primer3-sys --locked # verify the new upstream still packages and builds
git add primer3-sys/vendor/primer3
git commit -m "chore: bump primer3 to <ref>"If upstream renames or adds a file that build.rs compiles, the include glob in primer3-sys/Cargo.toml may need to be updated in the same commit — the cargo package step above will catch missing files by failing the verify rebuild.
The installed pre-commit hook runs cargo ci-fmt and cargo ci-lint before each commit.
To also run tests as part of the pre-commit hook:
PRIMER3_PRECOMMIT_TEST=1 git commit -m "..."The hook can be bypassed with git commit --no-verify when needed.
- Format with
rustfmt(max line width 100) - All clippy warnings are errors, including pedantic lints
- Use backticks around types in doc comments (e.g.,
`PrimerSettings`) - Documentation comments on all public items
- Keep PRs focused (250-1000 lines of change)
- Include tests for new functionality
- Ensure all CI checks pass before requesting review
- Use conventional commits for commit messages