First off, thank you for considering contributing to Trackforge.
If your contribution is not straightforward, please first discuss the change you wish to make by creating a new issue before making the change, or starting a discussion on GitHub.
We welcome high quality PRs, whether they are human generated or made with the assistance of AI tools, but we ask that you follow these guidelines:
- Attribution: Tell us about your use of AI tools.
- Review: Make sure you review every line of AI generated content for correctness and relevance.
- Quality: AI-generated content should meet the same quality standards as human-written content.
All contributions are welcome. Please include as many details as possible in your PR description.
- Aim for PRs under 500 lines of changes when possible.
- Separate refactoring, formatting, and functional changes into different PRs.
Run cargo fmt before committing to ensure that code is consistently formatted.
This repo ships a .pre-commit-config.yaml and runs the
hooks in CI with prek, a fast, dependency-free Rust
reimplementation of pre-commit. It reads the same config, so no extra setup file is
needed. We recommend the Rust install:
# Install prek (pick one)
cargo install --locked prek
# or, prebuilt binaries:
cargo binstall prek
# Set up the git hooks (pre-commit and commit-msg)
prek install
# Run every hook against the whole tree
prek run --all-filesThe hooks cover formatting (cargo fmt, taplo, prettier), linting (cargo clippy,
markdownlint), and hygiene (typos, trailing whitespace, merge-conflict markers). The
classic pre-commit run --all-files still works if you prefer it.
TL;DR: Clone the repo and build it using cargo (for Rust) or maturin (for Python).
git clone https://github.com/onuralpszr/trackforge.git
cd trackforge
# Pure Rust Development
cargo build
cargo test
# Python Development
# Ensure you are in a virtual environment
maturin develop- Rust: Run
cargo testto execute unit and integration tests. - Python: Run
pytest(when available) to check Python bindings.
We use GitHub Actions for CI where we perform the following checks:
- The code should compile on stable Rust.
- The tests should pass (
cargo test). - The code should be formatted (
cargo fmt). - The code should pass hygiene checks (
cargo clippy).
You can check these locally:
cargo fmt --all -- --check
cargo clippy -- -D warnings
cargo testWe use a hybrid documentation strategy to serve both Python and Rust API docs in a single zensical site.
- Python:
zensical,mkdocstrings[python],maturin - Rust:
cargo-docs-md - Rust Toolchain:
nightly(required for JSON output)
# Install Python deps
pip install zensical "mkdocstrings[python]" maturin
# Install Rust tool
cargo install cargo-docs-md-
Build Python Package:
maturin develop
-
Generate Rustdoc JSON:
RUSTDOCFLAGS="-Z unstable-options --output-format json" cargo +nightly doc --no-deps -
Convert to Markdown:
mkdir -p docs/api cargo docs-md -p target/doc/trackforge.json -o docs/api --full-method-docs
-
Fix Formatting: Run the cleaning script to format tables and code blocks:
python3 scripts/fix_docs.py
-
Serve:
zensical serve
Open http://127.0.0.1:8000.