File size: 5,275 Bytes
f206b57 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | # 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! 🚀
|