Thank you for your interest in contributing to OpenControl! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- Development Setup
- Contributing Process
- Code Standards
- Testing
- Documentation
- Pull Request Process
This project adheres to a code of conduct that promotes a welcoming and inclusive environment. We expect all contributors to:
- Be respectful and considerate in all interactions
- Focus on constructive feedback and collaboration
- Respect different viewpoints and experiences
- Show empathy towards other community members
- Python 3.9 or higher
- Git
- CUDA-capable GPU (recommended for training)
- 16GB+ RAM (recommended)
-
Fork and Clone
git clone https://github.com/your-username/opencontrol.git cd opencontrol -
Set up Development Environment
# Using uv (recommended) curl -LsSf https://astral.sh/uv/install.sh | sh uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv pip install -e ".[dev]" # Or using pip python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -e ".[dev]"
-
Install Pre-commit Hooks
pre-commit install
-
Verify Installation
python test_system.py
- Look for issues labeled
good first issuefor beginners - Check existing issues and discussions before creating new ones
- For major changes, open an issue first to discuss the approach
git checkout -b feature/your-feature-name
# or
git checkout -b fix/issue-description- Follow the code standards outlined below
- Write tests for new functionality
- Update documentation as needed
- Ensure all tests pass
git add .
git commit -m "feat: add new multimodal encoder architecture"Use conventional commit messages:
feat:for new featuresfix:for bug fixesdocs:for documentation changestest:for adding testsrefactor:for code refactoringperf:for performance improvements
We use the following tools to maintain code quality:
- Black: Code formatting
- isort: Import sorting
- flake8: Linting
- mypy: Type checking
Run all checks:
# Format code
black opencontrol/ tests/
isort opencontrol/ tests/
# Check linting
flake8 opencontrol/ tests/
# Type checking
mypy opencontrol/-
Type Hints: Use type hints for all function signatures
def process_data(data: torch.Tensor, config: Config) -> Dict[str, Any]: ...
-
Docstrings: Use Google-style docstrings
def compute_attention(query: torch.Tensor, key: torch.Tensor) -> torch.Tensor: """Compute multi-head attention. Args: query: Query tensor of shape (batch, seq_len, d_model) key: Key tensor of shape (batch, seq_len, d_model) Returns: Attention output tensor of shape (batch, seq_len, d_model) """
-
Error Handling: Use appropriate exception handling
try: result = risky_operation() except SpecificError as e: logger.error(f"Operation failed: {e}") raise
-
Logging: Use structured logging
logger.info("Starting training", extra={ "epoch": epoch, "batch_size": batch_size, "learning_rate": lr })
- Modularity: Keep components loosely coupled
- Configuration: Use dataclasses for configuration
- Testing: Write unit tests for all new functionality
- Performance: Consider memory and computational efficiency
- Documentation: Document complex algorithms and design decisions
# Run all tests
pytest
# Run specific test file
pytest tests/test_world_model.py
# Run with coverage
pytest --cov=opencontrol
# Run performance benchmarks
pytest --benchmark-only-
Unit Tests: Test individual components
def test_attention_mechanism(): attention = MultiModalAttention(512, 8) x = torch.randn(2, 10, 512) output, weights = attention(x) assert output.shape == x.shape
-
Integration Tests: Test component interactions
@pytest.mark.asyncio async def test_training_pipeline(): trainer = create_trainer() await trainer.train_one_epoch() assert trainer.metrics['loss'] < initial_loss
-
Performance Tests: Test computational requirements
@pytest.mark.benchmark def test_inference_speed(benchmark): result = benchmark(model.forward, input_data) assert result is not None
- Use clear, descriptive variable and function names
- Add docstrings to all public functions and classes
- Include type hints for better IDE support
- Document complex algorithms with inline comments
- Update docstrings when changing function signatures
- Include examples in docstrings for complex functions
- Document configuration options and their effects
- Update README.md for user-facing changes
- Add examples for new features
- Update installation instructions if dependencies change
-
Ensure all tests pass
pytest
-
Check code quality
black --check opencontrol/ tests/ flake8 opencontrol/ tests/ mypy opencontrol/
-
Update documentation
- Add docstrings for new functions
- Update README if needed
- Add examples for new features
When creating a pull request, include:
- Description: Clear description of changes
- Motivation: Why this change is needed
- Testing: How the changes were tested
- Breaking Changes: Any backward compatibility issues
- Related Issues: Link to related issues
- Automated Checks: CI will run tests and quality checks
- Code Review: Maintainers will review the code
- Feedback: Address any feedback or requested changes
- Approval: Once approved, the PR will be merged
- All CI checks must pass
- At least one maintainer approval
- No unresolved conversations
- Up-to-date with main branch
- Profile code before optimizing
- Use appropriate data types (float16 vs float32)
- Consider memory usage in large-scale training
- Leverage GPU acceleration where possible
- Use descriptive error messages
- Add logging to track execution flow
- Use debugger breakpoints for complex issues
- Test with small datasets first
- Write self-documenting code
- Keep functions small and focused
- Use meaningful variable names
- Avoid premature optimization
- Test edge cases and error conditions
- Issues: Open an issue for bugs or feature requests
- Discussions: Use GitHub Discussions for questions
- Email: Contact nikjois@llamasearch.ai for urgent matters
Contributors will be recognized in:
- CONTRIBUTORS.md file
- Release notes for significant contributions
- Project documentation
Thank you for contributing to OpenControl!