We welcome contributions to the OCRmyPDF GUI Client! This document provides guidelines for contributing to the project.
Before contributing, please ensure you have:
-
Python 3.10+ installed
-
System dependencies installed:
- Tesseract OCR 4.1.1+
- Ghostscript 9.54+
- PyQt5 development libraries
-
Development tools:
pip install black pytest pytest-qt mypy flake8
-
Clone the repository:
git clone https://github.com/tw4/OCRmyPDF-Qt-GUI-Client.git cd OCRmyPDF-Qt-GUI-Client -
Create virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt pip install -e .[dev] # Install in development mode with dev dependencies -
Run the application:
python main.py
We use Black for code formatting. Please run Black on your code before submitting:
black .-
Use flake8 for linting:
flake8 . -
Use mypy for type checking:
mypy .
- Follow PEP 8 style guidelines
- Use type hints where appropriate
- Write docstrings for all public functions and classes
- Keep functions focused and single-purpose
- Use meaningful variable names
# Run all tests
pytest
# Run with coverage
pytest --cov=. --cov-report=html
# Run GUI tests (requires display)
pytest tests/test_gui.py- Place tests in the
tests/directory - Use pytest fixtures for setup/teardown
- Mock external dependencies (OCRmyPDF, file system)
- Test both success and failure scenarios
Example test structure:
import pytest
from unittest.mock import Mock, patch
from gui.main_window import MainWindow
def test_add_files_valid_pdfs(qtbot):
"""Test adding valid PDF files to the application."""
window = MainWindow()
qtbot.addWidget(window)
# Test implementation here
assert len(window.file_list) == 0 # Initial state
# Add your test logic- Check existing issues before creating new ones
- Create an issue to discuss new features or significant changes
- Use issue templates when available
- Fork the repository on GitHub
- Create a feature branch from
main:git checkout -b feature/your-feature-name
- Write code following the guidelines above
- Add tests for new functionality
- Update documentation if needed
- Commit frequently with clear messages:
git commit -m "feat: add batch processing progress indicator"
Use conventional commit format:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or modifying testschore:- Maintenance tasks
-
Push your branch to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
-
Fill out the PR template completely
-
Link related issues using keywords (fixes #123)
- Code follows project style guidelines
- Tests pass locally
- New functionality has tests
- Documentation is updated
- Commit messages follow convention
- PR description explains the changes
- Automated checks must pass (CI/CD)
- Code review by maintainers
- Address feedback promptly
- Squash merge after approval
- Reproduce the bug with test cases
- Fix the issue with minimal changes
- Add regression tests to prevent recurrence
- Update documentation if behavior changes
- Discuss the feature in an issue first
- Design the API before implementation
- Implement incrementally with tests
- Update user documentation
- Consider backward compatibility
- Follow Qt design guidelines
- Maintain dark theme compatibility
- Test on multiple platforms if possible
- Consider accessibility requirements
- Get feedback from users when possible
- Keep README.md up to date
- Document new features clearly
- Include code examples where helpful
- Update installation instructions as needed
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: General questions and ideas
- Code Review: PR comments for specific code feedback
- OCRmyPDF Documentation: https://ocrmypdf.readthedocs.io/
- PyQt5 Documentation: https://doc.qt.io/qtforpython/
- Python Testing: https://docs.pytest.org/
Contributors will be recognized in:
- CONTRIBUTORS.md file
- Release notes for significant contributions
- About dialog in the application
By contributing, you agree that your contributions will be licensed under the Mozilla Public License 2.0, the same license that covers the project.
Thank you for contributing to OCRmyPDF GUI Client! 🎉