Thank you for your interest in contributing to MirrorPy! This document provides guidelines and instructions for contributing.
- Python 3.8+
- Git
- ADB (Android Debug Bridge)
- An Android device for testing
# Fork and clone the repo
git clone https://github.com/YOUR_USERNAME/mirrorpy.git
cd mirrorpy
# Install dependencies
pip install -r requirements.txt
# Run tests
python -m unittest test_mirror -v- Check existing issues first
- Open a new issue with:
- Clear title and description
- Steps to reproduce
- Expected vs actual behavior
- OS, Python version, Android version
- Screenshots if applicable
- Open an issue with the
enhancementlabel - Describe the feature and use case
- Explain why it would benefit users
- Fork the repository
- Create a branch for your feature/fix:
git checkout -b feature/amazing-feature
- Make your changes following the code style below
- Add tests for new functionality
- Run tests to ensure nothing is broken:
python -m unittest test_mirror -v
- Commit with a clear message:
git commit -m "feat: add amazing feature" - Push to your fork:
git push origin feature/amazing-feature
- Open a Pull Request
- Follow PEP 8
- Use type hints where practical
- Keep functions focused and under 50 lines
- Add docstrings for public functions
def discover_devices(timeout: int = 5) -> list[dict]:
"""
Discover Android devices on the network.
Args:
timeout: Discovery timeout in seconds
Returns:
List of device dicts with keys: serial, ip, port, model
"""
...Use Conventional Commits:
feat:— New featurefix:— Bug fixdocs:— Documentationtest:— Adding testsrefactor:— Code refactoringchore:— Maintenance
Examples:
feat: add QR code generation for pairing
fix: auto-detect returns laptop IP instead of phone
test: add tests for mDNS discovery
docs: update README with installation guide
- Keep PRs focused on one change
- Reference related issues (e.g.,
Fixes #42) - Update documentation if needed
- Add tests for new features
- Ensure all tests pass
# All tests
python -m unittest test_mirror -v
# Specific test class
python -m unittest test_mirror.TestFullDiscover -v
# With coverage (install coverage first: pip install coverage)
coverage run -m unittest test_mirror
coverage report- Place tests in
test_mirror.py - Use
unittest.mockfor external dependencies (ADB, network) - Test both success and failure cases
- Keep tests fast and isolated
class TestNewFeature(unittest.TestCase):
@patch("mirror.run_cmd")
def test_feature_works(self, mock_cmd):
mock_cmd.return_value = ("success", "", 0)
result = new_feature()
self.assertEqual(result, "expected")mirrorpy/
├── mirror.py # Main application
├── test_mirror.py # Unit tests
├── requirements.txt # Dependencies
├── settings.ini # User config (gitignored)
├── .github/workflows/ # CI/CD
└── README.md # Documentation
Open an issue with the question label or start a Discussion.
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.