Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this project.
- Getting Started
- Development Setup
- Project Structure
- Making Changes
- Testing
- Submitting Changes
- Code Style
- Reporting Issues
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/ATP-Rankings-Data-Visualization.git cd ATP-Rankings-Data-Visualization - Create a branch for your changes:
git checkout -b feature/your-feature-name
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
uvicorn src.main:app --reload
-
Run tests:
pytest tests/ -v
src/ # Core application code
├── main.py # FastAPI application
├── services.py # Business logic
└── mcp_router.py # MCP endpoints
scripts/ # Utility scripts
├── analyze.py # CLI analysis tool
├── generate.py # Database generation
└── filler.py # Database updates
templates/ # HTML templates
tests/ # Test suite
docs/ # Documentation
-
Service Layer (
src/services.py):- Add business logic and database operations
- Functions should return data structures (dicts, lists)
- Raise
ValueErrorfor error conditions
-
API Endpoints (
src/main.py):- Add REST API routes for web access
- Convert service errors to HTTP exceptions
-
MCP Endpoints (
src/mcp_router.py):- Add MCP-compliant endpoints for AI access
- Use
MCPResponsewrapper for consistent format - Update
mcp_manifest.jsonwith new tool definitions
-
Templates (
templates/):- Add HTML templates for new web pages
- Use Jinja2 templating
- Include Chart.js for visualizations
- Use
scripts/generate.pyas reference for scraping - Update
scripts/filler.pyfor incremental updates - Test with
scripts/debug.pyto find issues
pytest tests/ -vpytest tests/test_mcp.py::TestMCPHealth -vpytest tests/ --cov=src --cov-report=html# Test MCP endpoints
bash scripts/test_mcp.sh
# Test web interface
uvicorn src.main:app --reload
# Visit http://localhost:8000When adding features, please include:
- Unit tests for service functions
- Integration tests for API endpoints
- MCP endpoint tests if applicable
Example:
# tests/test_your_feature.py
def test_new_feature():
from src.services import your_new_function
result = your_new_function(test_input)
assert result == expected_output-
Commit your changes:
git add . git commit -m "Add feature: clear description of changes"
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request:
- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your fork and branch
- Provide a clear description of changes
- Reference any related issues
- Title: Clear, concise description of changes
- Description:
- What does this PR do?
- Why is this change needed?
- How has it been tested?
- Tests: Include tests for new features
- Documentation: Update README.md or docs/ if needed
Follow PEP 8 style guidelines:
# Good
def get_player_stats(player_name: str) -> dict:
"""Get statistics for a player.
Args:
player_name: Full name of the player
Returns:
Dictionary with player statistics
"""
return stats
# Use descriptive variable names
player_data = get_player_stats("Roger Federer")
# Type hints for function signatures
def process_rankings(week: str, limit: int = 100) -> list[dict]:
pass# Use Pydantic models for request/response
class PlayerRequest(BaseModel):
player: str = Field(..., description="Player name")
@router.post("/player-stats")
async def get_stats(request: PlayerRequest):
return {"ok": True, "result": stats}- Use docstrings for functions and classes
- Inline comments for complex logic
- Keep comments up-to-date with code changes
Please include:
- Description: Clear description of the bug
- Steps to Reproduce: Exact steps to reproduce the issue
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Environment:
- OS (Linux, macOS, Windows)
- Python version
- Browser (if web-related)
- Logs: Any error messages or logs
Please include:
- Description: Clear description of the feature
- Use Case: Why is this feature needed?
- Proposed Solution: How could this be implemented?
- Alternatives: Any alternative solutions considered?
When adding features, please update:
- README.md: For user-facing changes
- docs/: For technical documentation
- Code comments: For implementation details
- CHANGELOG.md: For all changes
- Code follows project style guidelines
- Tests added and passing
- Documentation updated
- Commit messages are clear
- Branch is up-to-date with main
- No merge conflicts
- Maintainers will review your PR
- They may request changes or ask questions
- Address feedback and push updates
- Once approved, your PR will be merged
- Your contribution will be credited in CHANGELOG.md
- Start small - fix bugs or improve documentation first
- Ask questions - open an issue to discuss large changes
- Be patient - reviews may take a few days
- Be respectful - follow the code of conduct
Open an issue on GitHub with the "question" label.
Thank you for contributing to ATP Rankings Data Visualization!