Contributing to TorchForge
Thank you for your interest in contributing to TorchForge! This document provides guidelines and instructions for contributing.
Code of Conduct
We are committed to providing a welcoming and inclusive environment. Please be respectful and professional in all interactions.
How to Contribute
Reporting Bugs
Before creating a bug report:
- Check the existing issues
- Verify you're using the latest version
- Collect relevant information (Python version, PyTorch version, OS, etc.)
Create a bug report with:
- Clear, descriptive title
- Steps to reproduce
- Expected behavior
- Actual behavior
- Code sample (if applicable)
- Error messages and stack traces
Suggesting Features
We welcome feature suggestions! Please:
- Check existing feature requests
- Describe the problem your feature would solve
- Explain your proposed solution
- Consider alternative approaches
Pull Requests
Setup Development Environment
# Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/torchforge.git
cd torchforge
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode with dev dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
Development Workflow
Create a branch
git checkout -b feature/your-feature-nameMake your changes
- Write clear, documented code
- Follow existing code style
- Add tests for new functionality
- Update documentation as needed
Run tests
# Run all tests pytest tests/ -v # Run with coverage pytest tests/ --cov=torchforge --cov-report=html # Run specific test pytest tests/test_core.py::TestForgeModel::test_model_creationFormat code
# Format with black black torchforge/ tests/ # Sort imports isort torchforge/ tests/ # Check style flake8 torchforge/ # Type check mypy torchforge/Commit changes
git add . git commit -m "feat: add new feature description"Follow Conventional Commits:
feat:New featurefix:Bug fixdocs:Documentation changestest:Adding or updating testsrefactor:Code refactoringperf:Performance improvementschore:Build process or auxiliary tool changes
Push and create PR
git push origin feature/your-feature-nameThen create a Pull Request on GitHub with:
- Clear description of changes
- Link to related issues
- Screenshots (if UI changes)
- Test results
Code Style Guidelines
Python Style
- Follow PEP 8
- Use type hints
- Maximum line length: 100 characters
- Use docstrings for all public functions/classes
Documentation Style
def function_name(param1: str, param2: int) -> bool:
"""
Short description of function.
Longer description with more details about what the function
does and when to use it.
Args:
param1: Description of param1
param2: Description of param2
Returns:
Description of return value
Raises:
ValueError: When param1 is invalid
Example:
>>> result = function_name("test", 42)
>>> print(result)
True
"""
pass
Testing Guidelines
- Write tests for all new features
- Aim for >80% code coverage
- Use descriptive test names
- Include edge cases and error conditions
def test_feature_name_with_valid_input():
"""Test that feature works with valid input."""
# Arrange
model = create_test_model()
# Act
result = model.some_method()
# Assert
assert result.status == "success"
Documentation
When adding new features:
- Update relevant documentation files
- Add docstrings to all public APIs
- Include code examples
- Update CHANGELOG.md
Areas for Contribution
We especially welcome contributions in:
Core Features
- Additional compliance frameworks (EU AI Act, ISO 42001)
- Advanced monitoring capabilities
- Performance optimizations
- Cloud provider integrations
Documentation
- Tutorial improvements
- Example notebooks
- API documentation
- Translation to other languages
Testing
- Test coverage improvements
- Performance benchmarks
- Integration tests
Infrastructure
- CI/CD improvements
- Docker optimizations
- Kubernetes best practices
Community
- GitHub Discussions: Ask questions, share ideas
- GitHub Issues: Bug reports and feature requests
- LinkedIn: Follow @anilsprasad for updates
Recognition
Contributors will be:
- Listed in CONTRIBUTORS.md
- Mentioned in release notes
- Recognized in the annual contributor report
Thank you for contributing to TorchForge! 🚀