Skip to content

Latest commit

 

History

History
70 lines (49 loc) · 2.22 KB

File metadata and controls

70 lines (49 loc) · 2.22 KB

Contributing to primer3-rs

Development Setup

  1. Install Rust via rustup (the pinned toolchain version will be installed automatically from rust-toolchain.toml)
  2. Ensure you have a C/C++ compiler and libclang installed (required for building the vendored C library and generating FFI bindings)
  3. Clone the repository with submodules:
git clone --recurse-submodules https://github.com/fg-labs/primer3-rs.git
cd primer3-rs
  1. Install git hooks:
./scripts/install-hooks.sh

CI Commands

Three 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 tests

Run all three before submitting a PR.

Updating Vendored primer3

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.

Pre-commit Hook

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.

Code Style

  • 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

Pull Requests

  • 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