Contributing to Gym¶
Thank you for your interest in contributing to Gym! As a project by Zoo Labs Foundation (501©(3) non-profit), we welcome contributions from the community.
How to Contribute¶
Types of Contributions¶
- Code: Bug fixes, new features, performance improvements
- Documentation: Tutorials, API docs, examples
- Datasets: High-quality training data
- Bug Reports: Issues you encounter
- Feature Requests: Ideas for improvements
- Community Support: Helping others on Discord/GitHub
Getting Started¶
Development Setup¶
-
Fork the repository
-
Create development environment
-
Install pre-commit hooks
-
Create a branch
Making Changes¶
- Write code
- Follow PEP 8 style guide
- Add type hints
- Include docstrings
-
Keep functions focused and small
-
Add tests
-
Update documentation
- Add docstrings to new functions
- Update relevant .md files
-
Add examples if applicable
-
Run checks
Submitting Changes¶
- Commit your changes
Follow Conventional Commits: - feat: New feature - fix: Bug fix - docs: Documentation - test: Tests - refactor: Code refactoring - perf: Performance improvement - chore: Maintenance
-
Push to your fork
-
Create Pull Request
- Go to GitHub and click "New Pull Request"
- Fill in PR template
- Link related issues
- Request review
Code Style¶
Python Style¶
"""Module docstring explaining purpose."""
from typing import Optional, List
import torch
class MyTrainer:
"""Class docstring with description.
Args:
model: The model to train
config: Training configuration
Example:
>>> trainer = MyTrainer(model, config)
>>> trainer.train()
"""
def __init__(self, model: torch.nn.Module, config: dict) -> None:
"""Initialize trainer."""
self.model = model
self.config = config
def train(self, epochs: int = 3) -> dict:
"""Train the model.
Args:
epochs: Number of training epochs
Returns:
Dictionary with training metrics
"""
# Implementation
pass
Documentation Style¶
- Use Markdown for all docs
- Include code examples that work
- Add screenshots where helpful
- Cross-reference related docs
- Keep paragraphs short and scannable
Testing¶
Running Tests¶
# All tests
pytest tests/ -v
# Specific test file
pytest tests/test_trainer.py -v
# With coverage
pytest tests/ --cov=gym --cov-report=html
# Specific test function
pytest tests/test_trainer.py::test_basic_training -v
Writing Tests¶
"""Test module for new feature."""
import pytest
from gym.train import MyTrainer
def test_trainer_initialization():
"""Test trainer can be initialized."""
trainer = MyTrainer(model, config)
assert trainer.model is not None
def test_training_loop():
"""Test training completes successfully."""
trainer = MyTrainer(model, config)
result = trainer.train(epochs=1)
assert "loss" in result
assert result["loss"] < 10.0
@pytest.mark.slow
def test_full_training():
"""Test complete training pipeline."""
# Long-running test
pass
Documentation¶
Building Docs Locally¶
# Install docs dependencies
pip install -r requirements-docs.txt
# Build docs
mkdocs build
# Serve docs locally
mkdocs serve
# Open http://localhost:8000
Adding New Documentation¶
- Create
.mdfile indocs/ - Add to
mkdocs.ymlnavigation - Follow existing structure
- Include code examples
- Add cross-references
Review Process¶
What We Look For¶
- Functionality: Does it work as intended?
- Tests: Are there tests? Do they pass?
- Documentation: Is it documented?
- Code Quality: Is it clean and maintainable?
- Performance: Does it affect performance?
- Breaking Changes: Does it break existing code?
Review Timeline¶
- Initial review: 1-3 days
- Follow-up reviews: 1-2 days
- Merge: After approval and CI passes
Community Guidelines¶
Code of Conduct¶
- Be respectful and inclusive
- Welcome newcomers
- Give constructive feedback
- Credit others' work
- Report unacceptable behavior to conduct@zoo.ngo
Communication¶
- GitHub Issues: Bug reports, feature requests
- GitHub Discussions: Questions, ideas
- Discord: Real-time chat, community support
- Email: Private matters (support@zoo.ngo)
Recognition¶
Contributors¶
All contributors are: - Listed in CONTRIBUTORS.md - Credited in release notes - Eligible for swag (stickers, shirts) - Invited to contributor calls
Significant Contributions¶
Major contributions may receive: - Co-authorship on papers - Speaking opportunities - Grants for continued work - Tax-deductible donation receipts (501©(3))
Legal¶
Contributor License Agreement¶
By contributing, you agree that: - Your contributions are your own work - You grant Zoo Labs Foundation rights to use/distribute - Your contributions are under Apache 2.0 license - You have rights to make the contribution
Copyright¶
Questions?¶
- General: GitHub Discussions
- Bugs: GitHub Issues
- Chat: Discord
- Email: support@zoo.ngo
Thank you for contributing to democratizing AI! 🎉