| # 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: | |
| 1. Check the [existing issues](https://github.com/anilprasad/torchforge/issues) | |
| 2. Verify you're using the latest version | |
| 3. 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: | |
| 1. Check existing feature requests | |
| 2. Describe the problem your feature would solve | |
| 3. Explain your proposed solution | |
| 4. Consider alternative approaches | |
| ### Pull Requests | |
| #### Setup Development Environment | |
| ```bash | |
| # 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 | |
| 1. **Create a branch** | |
| ```bash | |
| git checkout -b feature/your-feature-name | |
| ``` | |
| 2. **Make your changes** | |
| - Write clear, documented code | |
| - Follow existing code style | |
| - Add tests for new functionality | |
| - Update documentation as needed | |
| 3. **Run tests** | |
| ```bash | |
| # 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_creation | |
| ``` | |
| 4. **Format code** | |
| ```bash | |
| # Format with black | |
| black torchforge/ tests/ | |
| # Sort imports | |
| isort torchforge/ tests/ | |
| # Check style | |
| flake8 torchforge/ | |
| # Type check | |
| mypy torchforge/ | |
| ``` | |
| 5. **Commit changes** | |
| ```bash | |
| git add . | |
| git commit -m "feat: add new feature description" | |
| ``` | |
| Follow [Conventional Commits](https://www.conventionalcommits.org/): | |
| - `feat:` New feature | |
| - `fix:` Bug fix | |
| - `docs:` Documentation changes | |
| - `test:` Adding or updating tests | |
| - `refactor:` Code refactoring | |
| - `perf:` Performance improvements | |
| - `chore:` Build process or auxiliary tool changes | |
| 6. **Push and create PR** | |
| ```bash | |
| git push origin feature/your-feature-name | |
| ``` | |
| Then 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** | |
| ```python | |
| 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 | |
| ```python | |
| 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: | |
| 1. Update relevant documentation files | |
| 2. Add docstrings to all public APIs | |
| 3. Include code examples | |
| 4. 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](https://www.linkedin.com/in/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! 🚀 | |