Contributing

Thank you for your interest in contributing to Anemoi Graphs! This guide will help you get started with the development process.

Setting Up the Development Environment

  1. Clone the repository:

    git clone https://github.com/ecmwf/anemoi-graphs/
    cd anemoi-graphs
    
  2. Install dependencies:

    # For all dependencies
    pip install -e .
    
    # For development dependencies
    pip install -e '.[dev]'
    
  3. (macOS only) Install pandoc for documentation building:

    brew install pandoc
    

Pre-Commit Hooks

We use pre-commit hooks to ensure code quality and consistency. To set them up:

  1. Install pre-commit hooks:

    pre-commit install
    
  2. Run hooks on all files to verify installation:

    pre-commit run --all-files
    

Commit Guidelines

Ideally, open an issue for the feature or bug fix you’re working on before starting development, to discuss the approach with maintainers.

When committing code changes:

  1. Make small, focused commits with clear and concise messages.

  2. Follow the Conventional Commits guidelines, e.g., “feat:”, “fix:”, “docs:”, etc.

  3. Use present tense and imperative mood in commit messages (e.g., “Add feature” not “Added feature”).

  4. Reference relevant issue numbers in commit messages when applicable.

  5. Update the CHANGELOG.md file with a human-friendly summary of your changes.

Pull Request Process

  1. Create a new branch for your feature or bug fix.

  2. Make your changes and commit them using the guidelines above.

  3. Push your branch to your fork on GitHub.

  4. Open a Pull Request against the develop branch of the main repository.

  5. Ensure all tests pass and the code adheres to the project’s style guidelines.

  6. Request a review from maintainers or other contributors.

Running Tests

We use pytest for our test suite. To run tests:

# Run all tests
pytest

# Run tests in a specific file
pytest tests/test_<file>.py

Note: Some tests, like test_gnn.py, may run slower on CPU and are better suited for GPU execution.

Building Documentation

You can build the documentation locally to preview changes before submitting a Pull Request. We use Sphinx for documentation.

You can install the dependencies for building the documentation with:

pip install '.[docs]'

To build the documentation locally:

cd docs
make html

The generated documentation will be in docs/_build/html/index.html.

Code Review Process

  1. All code changes must be reviewed before merging.

  2. Address any feedback or comments from reviewers promptly.

  3. Once approved, a maintainer will merge your Pull Request.

Reporting Issues

If you encounter a bug or have a feature request:

  1. Check the existing issues to avoid duplicates.

  2. If it’s a new issue, create a detailed bug report or feature request.

  3. Use clear, descriptive titles and provide as much relevant information as possible.

Thank you for contributing to Anemoi Graphs! Your efforts help improve the project for everyone.