Thank you for your interest in contributing to DeepDriveMD! This document provides guidelines and instructions for contributing.
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone.
If you find a bug, please open an issue on GitHub with:
- A clear, descriptive title
- Steps to reproduce the issue
- Expected behavior vs actual behavior
- Your environment (Python version, OS, etc.)
- Any relevant log output or error messages
Feature requests are welcome! Please open an issue with:
- A clear description of the feature
- The use case or problem it solves
- Any implementation ideas you have
-
Fork the repository and create your branch from
main:git checkout -b feature/my-new-feature
-
Set up your development environment:
pip install -e ".[dev,lint]" -
Make your changes following our coding standards (see below)
-
Add tests for any new functionality
-
Run the test suite to ensure nothing is broken:
pytest tests/unit
-
Run linting to check code style:
ruff check ddmd tests ruff format --check ddmd tests
-
Commit your changes with a clear commit message:
git commit -m "Add feature: description of the feature" -
Push to your fork and submit a pull request
- Python 3.9 or higher
- pip
# Clone your fork
git clone https://github.com/YOUR_USERNAME/DeepDriveMD.git
cd DeepDriveMD
# Install in development mode with all dependencies
pip install -e ".[dev,lint,doc]"# Run unit tests
pytest tests/unit
# Run integration tests
pytest tests/integration
# Run with coverage
pytest --cov=ddmd --cov-report=html
# Run specific test file
pytest tests/unit/test_logger.py
# Run specific test
pytest tests/unit/test_logger.py::TestLoggerInit::test_default_initialization# Run tests across all Python versions
tox
# Run only linting
tox -e lint
# Run only formatting check
tox -e format
# Run coverage report
tox -e coverageWe use ruff for linting and formatting. The configuration is in pyproject.toml.
Key style points:
- Line length: 88 characters
- Use double quotes for strings
- Use spaces for indentation (4 spaces)
- Follow PEP 8 guidelines
Before committing, format your code:
ruff format ddmd tests
ruff check --fix ddmd testsWe encourage the use of type hints for function signatures:
async def check_train_data(self) -> bool:
"""Check if enough training data is available."""
...Use descriptive docstrings for classes and public methods:
class MyWorkflow(DDMD_manager):
"""
Custom workflow for specific simulation type.
This workflow handles X, Y, and Z by doing A, B, and C.
"""
def stop_simulation(self, prediction: float) -> bool:
"""
Decide whether to stop a simulation based on prediction score.
Args:
prediction: The ML model's prediction score (0.0 to 1.0)
Returns:
True if the simulation should be stopped, False otherwise
"""
...- Use
async/awaitconsistently - Prefer
asyncio.gather()for parallel operations - Use
asyncio.to_thread()for blocking I/O operations
DeepDriveMD/
├── ddmd/ # Main package
│ ├── __init__.py
│ ├── ddmd_manager.py # Base manager class
│ ├── logger.py # Logging utilities
│ └── pipelines/ # Workflow implementations
│ ├── dummy_learner.py
│ └── miniapps_pipeline.py
├── tests/ # Test suite
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
├── examples/ # Example implementations
├── doc/ # Documentation
├── pyproject.toml # Project configuration
└── tox.ini # Test automation
To create a custom workflow, extend DDMD_manager:
from ddmd import DDMD_manager
class MyWorkflow(DDMD_manager):
def __init__(self, asyncflow, **kwargs):
super().__init__(asyncflow)
self._register_learner_tasks()
def _register_learner_tasks(self):
# Register your simulation, training, and prediction tasks
pass
# Implement required abstract methods
def stop_simulation(self, prediction): ...
async def init_sim_queue(self): ...
async def check_train_data(self): ...
async def train_model(self): ...
async def clean_sim_data(self, sim_ind): ...If you have questions about contributing, feel free to:
- Open an issue on GitHub
- Contact the maintainers at mariya.goliyad@rutgers.edu
By contributing to DeepDriveMD, you agree that your contributions will be licensed under the MIT License.