Skip to content

Contributing

Thank you for your interest in contributing to NovaPhy!

Development Setup

  1. Clone the repository:

    git clone https://github.com/Novaphy/NovaPhy.git
    cd NovaPhy
    
  2. Create the conda environment:

    conda env create -f environment.yml
    conda activate novaphy
    
  3. Install in development mode:

    $env:CMAKE_TOOLCHAIN_FILE="C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake"
    pip install -e ".[dev]"
    

Code Conventions

C++

  • C++20 standard
  • float32 only — never use double; use Eigen *f types
  • #pragma once for include guards
  • Namespace: novaphy
  • Classes: PascalCase, functions: snake_case, private members: trailing_underscore_
  • Spatial algebra: [angular; linear] (Featherstone convention)

Python

  • PEP 8 style
  • Type hints where practical

Testing

Every new Python-exposed feature must have a corresponding test in tests/python/.

# Run full test suite
pytest tests/python/ -v

# Run specific test file
pytest tests/python/test_collision.py -v

Writing Tests

  • Use analytical comparisons for physics validation
  • Float32 tolerance: pytest.approx(expected, rel=1e-4)
  • Keep tests independent — no shared mutable state
  • Name files test_<module>.py, functions test_<behavior>

Code Quality

Formatting

# Check C++ formatting
find include/novaphy src python/bindings -name "*.h" -o -name "*.cpp" | xargs clang-format --dry-run --Werror

# Auto-fix
find include/novaphy src python/bindings -name "*.h" -o -name "*.cpp" | xargs clang-format -i

# Python linting
ruff check python/ tests/ demos/ --select=E,W,F,I

Documentation

Documentation is built with MkDocs Material and deployed to GitHub Pages.

# Install docs dependencies
pip install mkdocs-material pymdown-extensions mkdocs-autorefs

# Serve locally
mkdocs serve

# Build
mkdocs build

Pull Request Process

  1. Create a feature branch from main
  2. Make your changes with tests
  3. Ensure all tests pass: pytest tests/python/ -v
  4. Push and create a PR against main
  5. CI will run on Ubuntu and Windows

License

By contributing, you agree that your contributions will be licensed under the MIT License.