Thank you for your interest in contributing to Dendrite! This document provides guidelines and instructions for contributing.
- Rust 1.75 or later
- CUDA 12.x (optional, for GPU features)
# Clone the repository
git clone https://github.com/BioInfo/dendrite.git
cd dendrite
# Build the project
cargo build
# Run tests
cargo test
# Run with all checks (recommended before committing)
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-featuresWe use the following branch naming conventions:
main- Protected branch, always deployablefeature/*- New features (e.g.,feature/add-beam-search)fix/*- Bug fixes (e.g.,fix/memory-leak-in-cache)refactor/*- Code refactoringdocs/*- Documentation updates
-
Create a branch from
main:git checkout -b feature/your-feature-name
-
Make your changes following our coding standards
-
Write tests for new functionality (TDD encouraged)
-
Run the full check suite:
cargo fmt --all cargo clippy --all-targets --all-features -- -D warnings cargo test --all-features -
Commit your changes with a descriptive message:
git commit -m "feat: add beam search algorithm" -
Push and create a Pull Request
We follow Conventional Commits:
feat:- New featurefix:- Bug fixdocs:- Documentation onlyrefactor:- Code refactoring (no functional change)test:- Adding or updating testsperf:- Performance improvementchore:- Maintenance tasks
Examples:
feat: implement O(1) fork for tree state
fix: resolve memory leak in KV cache pool
docs: add architecture diagram to README
test: add property tests for block allocator
perf: optimize attention kernel dispatch
- Use
cargo fmtwith ourrustfmt.tomlconfiguration - Maximum line width: 100 characters
- Use 4 spaces for indentation
- All code must pass
cargo clippywith-D warnings - Address clippy suggestions or document exceptions
- All public APIs must have doc comments
- Include examples in doc comments where helpful
- Document safety requirements for
unsafecode
We practice Test-Driven Development (TDD):
- Write a failing test that defines the expected behavior
- Implement the minimum code to make the test pass
- Refactor while keeping tests green
crates/
dendrite-core/
src/
cache/
mod.rs
pool.rs
tests/ # Integration tests
cache_tests.rs
- Unit tests: In
#[cfg(test)]modules within source files - Integration tests: In
tests/directory - Property tests: Use
proptestfor invariant testing - Benchmarks: Use
criterioninbenches/
#[test]
fn fork_handle_shares_memory_with_parent() { ... }
#[test]
fn block_pool_returns_error_when_exhausted() { ... }- Profile before optimizing
- Document performance-critical code paths
- Add benchmarks for hot paths
- Ensure CI passes - All checks must be green
- Update documentation if needed
- Add tests for new functionality
- Keep PRs focused - One feature/fix per PR
- Respond to feedback promptly
- Code follows project style guidelines
- Tests added/updated for changes
- Documentation updated if needed
- Commit messages follow conventions
- CI passes
- Open an issue for bugs or feature requests
- Use discussions for questions
By contributing, you agree that your contributions will be licensed under the MIT License.