Contributing#
We welcome contributions to HERON! This guide covers the development workflow.
Development Setup#
# Clone the repository
git clone https://github.com/Criss-Wang/PowerGym.git
cd PowerGym
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install with development dependencies
pip install -e ".[dev,all]"
Running Tests#
# Run HERON core tests
pytest tests/ -v
# Run PowerGrid case study tests
pytest case_studies/power/tests/ -v
# Run all tests with coverage
pytest tests/ case_studies/power/tests/ --cov=heron --cov=powergrid --cov-report=html
Code Style#
We use the following tools for code quality:
# Format code with black
black heron/ case_studies/ tests/
# Lint with ruff
ruff check heron/ case_studies/ tests/
# Type check with mypy
mypy heron/ case_studies/power/powergrid/
Project Structure#
When contributing, please follow the project structure:
heron/ # Domain-agnostic framework (core changes)
case_studies/ # Domain-specific implementations
├── power/ # PowerGrid case study
└── your_domain/ # Your new case study
tests/ # HERON core tests
docs/ # Documentation
Contribution Types#
1. Bug Fixes#
Create an issue describing the bug
Fork the repository
Create a branch:
git checkout -b fix/issue-numberWrite tests that reproduce the bug
Fix the bug
Ensure tests pass
Submit a pull request
2. New Features#
Discuss in an issue first
Create a branch:
git checkout -b feature/feature-nameImplement with tests
Update documentation
Submit a pull request
3. New Case Studies#
To add a new domain case study:
Create directory:
case_studies/your_domain/Follow the PowerGrid structure as a template
Update
pyproject.tomlto include your packageAdd documentation
case_studies/your_domain/
├── your_package/
│ ├── __init__.py
│ ├── agents/ # Domain-specific agents
│ ├── envs/ # Domain-specific environments
│ └── utils/ # Domain-specific utilities
├── examples/ # Example scripts
├── tests/ # Domain tests
└── README.md # Domain documentation
4. New Protocols#
Implement in
heron/protocols/Add tests in
tests/protocols/Document usage in
docs/source/api/heron/protocols.rst
5. Message Broker Implementations#
To add a new message broker (e.g., Kafka, Redis):
Implement
MessageBrokerinterface inheron/messaging/Add connection handling and error recovery
Write integration tests
Document configuration
Pull Request Guidelines#
Clear description: Explain what and why
Tests: Include tests for new functionality
Documentation: Update docs for user-facing changes
Single purpose: One PR per feature/fix
Clean history: Squash commits if needed
Code Review Process#
Automated checks run (tests, linting)
Maintainer review
Address feedback
Merge when approved
Documentation#
Build documentation locally:
cd docs
make html
open build/html/index.html
Questions?#
Issues: GitHub Issues
Email: zhenlin.wang.criss@gmail.com
Thank you for contributing to HERON!