Thank you for your interest in contributing to ContrastCheck! This document provides guidelines and instructions for contributing.
By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.
Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include:
- A clear, descriptive title
- Detailed steps to reproduce the issue
- Expected vs actual behavior
- Screenshots if applicable
- Your environment (OS, Python version, etc.)
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:
- A clear, descriptive title
- Detailed description of the proposed feature
- Explanation of why this enhancement would be useful
- Possible implementation approach
- Fork the repository and create your branch from
main - Make your changes following our coding standards
- Add tests for any new functionality
- Ensure all tests pass by running
pytest - Update documentation if needed
- Commit your changes with clear, descriptive messages
- Push to your fork and submit a pull request
- Python 3.10 or higher
- uv package manager
- Clone your fork:
git clone https://github.com/yourusername/ContrastCheck.git
cd ContrastCheck- Install uv if you haven't already:
# On macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"- Create a virtual environment with Python 3.10+:
uv venv --python 3.10- Activate the virtual environment:
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate- Install development dependencies:
uv pip install -e ".[dev]"- Follow PEP 8
- Use Black for code formatting
- Use isort for import sorting
- Maximum line length: 88 characters (Black default)
Format your code before committing:
# Format code
black contrast_check/ tests/
# Sort imports
isort contrast_check/ tests/
# Check style
flake8 contrast_check/ tests/
# Type checking
mypy contrast_check/- Add docstrings to all public modules, classes, and functions
- Follow Google Python Style Guide for docstrings
- Update README.md for new features
- Include code examples where appropriate
- Write unit tests for all new functionality
- Maintain or improve code coverage
- Use descriptive test names
- Follow the Arrange-Act-Assert pattern
Run tests:
# Run all tests
pytest
# Run with coverage
pytest --cov=contrast_check --cov-report=html
# Run specific test file
pytest tests/test_contrast_checker.py -v- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters
- Reference issues and pull requests when relevant
Good commit message examples:
Add support for batch image processing
Implement WCAG AAA compliance checking
Fix color extraction edge case for small text regions
Update README with installation instructions
ContrastCheck/
├── contrast_check/ # Main package
│ ├── __init__.py
│ ├── ocr_extractor.py # OCR functionality
│ ├── color_extractor.py # Color extraction
│ ├── contrast_checker.py # Contrast calculation
│ └── main.py # CLI and main app
├── tests/ # Test suite
├── examples/ # Usage examples
├── docs/ # Documentation (future)
└── ...
- Test individual components in isolation
- Mock external dependencies (PaddleOCR, file I/O)
- Cover edge cases and error conditions
- Use parametrized tests for multiple scenarios
- Test components working together
- Use real but small test images
- Verify end-to-end functionality
- Aim for >90% code coverage
- Focus on critical paths
- Don't sacrifice quality for coverage percentage
- All public APIs must have docstrings
- Include parameter types and return types
- Provide usage examples for complex functions
- Explain the "why" not just the "what"
Update the README when you:
- Add new features
- Change CLI options
- Modify installation process
- Add new dependencies
- Update version in
setup.pyand__init__.py - Update CHANGELOG.md
- Create a new git tag
- Push to GitHub
- Create a GitHub release
- Publish to PyPI (maintainers only)
- Join discussions in GitHub Issues
- Ask questions in Pull Request comments
- Check existing documentation and issues first
Contributors will be recognized in:
- README.md contributors section
- Release notes
- GitHub contributors page
Thank you for contributing to ContrastCheck! 🎉