Contributing Guide
Thank you for your interest in Torch-RecHub! We welcome all forms of contributions, including but not limited to:
- Bug reports
- Feature suggestions
- Documentation improvements
- Code contributions
- Test cases
- Tutorials and examples
Quick Start
Development Environment Setup
bash
# 1. Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/torch-rechub.git
cd torch-rechub
# 2. Install dependencies and set up environment
uv sync
# 3. Install package in development mode
uv pip install -e .Development Workflow
- Fork the repository: Click the "Fork" button in the top right corner.
- Make changes: Implement new features or fix bugs.
- Format code: Run code formatting before committing to ensure consistent style:bash
python config/format_code.py - Commit changes:
git commit -m "feat: add new feature"orgit commit -m "fix: fix some issue"(following Conventional Commits is recommended). - Push to branch:
git push origin - Create Pull Request: Return to the original repository page, click "New pull request", compare your branch with the main repository's
mainbranch, then submit the PR.
Code Standards
Branch Naming
feature/feature-name- New featuresfix/bug-description- Bug fixesdocs/documentation-update- Documentation updatestest/test-description- Test additions
Commit Messages
We follow the Conventional Commits specification:
feat: add new recommendation modelfix: resolve memory leak in training loopdocs: update installation guidetest: add unit tests for DeepFM modelrefactor: optimize data loading pipeline
Pull Request Process
Push your branch
bashgit push origin your-branch-nameCreate Pull Request
- Visit the GitHub repository page
- Click "New pull request"
- Select your branch
- Fill in the PR template
PR Requirements
- Clear description of changes
- Explain why these changes are needed
- List related Issues (if any)
- Include test instructions
- Add screenshots (if applicable)
Testing Guide
Writing Tests
- Unit tests: Test individual functions or classes
- Integration tests: Test interactions between modules
- End-to-end tests: Test complete workflows
Running Tests
bash
# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/test_models/test_ranking.py
# Run with coverage report
uv run pytest --cov=torch_rechubDocumentation
Documentation Types
- API documentation: Docstrings in code
- User guides: Files in
docs/directory - Tutorials: Jupyter notebooks in
tutorials/directory - README: Project introduction and quick start
Documentation Standards
- Use Markdown format
- Include code examples
- Provide clear step-by-step instructions
- Keep English and Chinese versions in sync
- Follow Google-style Python docstrings
Contribution Ideas
Beginner-Friendly Tasks
- Improve documentation and comments
- Add test cases
- Fix simple bugs
- Translate documentation
- Add example code
- Code formatting and style improvements
Advanced Contributions
- Implement new recommendation algorithms
- Performance optimization
- Architecture improvements
- Add new evaluation metrics
- Develop tools and scripts
- Research paper implementations
Model Implementation Guide
When implementing new models:
- Follow existing patterns: Look at the structure of existing models
- Add comprehensive tests: Include unit and integration tests
- Provide examples: Add usage examples in
examples/directory - Detailed documentation: Include docstrings and README updates
- Performance benchmarks: Compare with existing implementations
Getting Help
If you encounter issues during contribution:
- Check existing Issues: There may be related discussions
- Create new Issue: Clearly describe your problem
- Join discussions: Ask questions in related Issues or PRs
- Contact maintainers: Via GitHub or email
Recognition
We value every contribution! All contributors will be recognized in:
- Contributors list in README
- Acknowledgments in release notes
- Contributors page in project documentation
- Special mentions for significant contributions
Code of Conduct
Please follow our Code of Conduct to ensure a friendly and inclusive community environment.
Thank you again for your contribution! Every contribution makes Torch-RecHub better.
