Thank you for your interest in contributing to LANCE! This document provides guidelines and instructions for contributing.
- Rust: 1.75+ (install via rustup)
- Python: 3.8+ (for pre-commit hooks)
- Git: 2.x+
-
Clone the repository:
git clone https://github.com/Nitecon/lance.git cd lance -
Install Rust toolchain:
rustup update stable rustup component add rustfmt clippy
-
Install pre-commit hooks:
pip install pre-commit pre-commit install pre-commit install --hook-type commit-msg
-
Verify setup:
cargo build cargo test pre-commit run --all-files
We use pre-commit hooks to ensure code quality before commits. The hooks will:
- Format code with
rustfmt - Lint code with
clippy(strict mode) - Check compilation with
cargo check - Enforce mechanical integrity rules from CodingGuidelines
- Validate commit messages (Conventional Commits format)
# Run all hooks on all files
pre-commit run --all-files
# Run specific hook
pre-commit run cargo-fmt --all-files
pre-commit run cargo-clippy --all-files
# Skip hooks temporarily (NOT recommended)
git commit --no-verify -m "wip: temporary commit"pre-commit autoupdateWe follow Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation only |
style |
Formatting, no code change |
refactor |
Code change that neither fixes a bug nor adds a feature |
perf |
Performance improvement |
test |
Adding or updating tests |
build |
Build system or dependencies |
ci |
CI/CD configuration |
chore |
Other changes (e.g., .gitignore) |
deps |
Dependency updates |
feat(network): add LWP protocol framing
fix(io): handle io_uring EAGAIN correctly
perf(core): use SIMD for CRC32 calculation
docs: update architecture diagram
deps: bump bytes crate to 1.5See CodingGuidelines.md for the complete list. Key rules:
- No allocations on hot path — Use
LoanableBatch,Bytesslicing - No locks on data plane — Use atomics, lock-free queues
- No
.unwrap()or.expect()— UseResultwith? - No dynamic dispatch — Use
T: Trait, notBox<dyn Trait> - Document all
unsafe— Include// SAFETY:comments
Code is auto-formatted with rustfmt. Configuration is in rustfmt.toml.
cargo fmt --allWe use strict Clippy settings:
cargo clippy --all-targets --all-features -- -D warnings# All tests
cargo test --all-features
# Specific test
cargo test test_name
# With output
cargo test -- --nocapture- Place unit tests in the same file as the code
- Place integration tests in
tests/ - Include latency assertions for performance-critical code:
#[test]
fn ingestion_latency_regression() {
let result = benchmark_ingestion(1_000_000);
assert!(result.p99_ns < 5_000, "P99 regression: {} ns", result.p99_ns);
}-
Create a feature branch:
git checkout -b feat/my-feature
-
Make changes following the coding guidelines
-
Ensure all checks pass:
cargo fmt --all cargo clippy --all-targets --all-features -- -D warnings cargo test --all-features pre-commit run --all-files -
Push and create PR:
git push origin feat/my-feature
-
PR will be reviewed for:
- Mechanical integrity (no allocations/locks on hot path)
- Test coverage
- Documentation
- Performance impact
- Open an issue for bugs or feature requests
- Start a discussion for questions or ideas
Thank you for contributing! 🦀