Contributing๏
We welcome contributions to QuScope! This guide will help you get started.
๐ค How to Contribute๏
There are many ways to contribute to QuScope:
๐ Report bugs via GitHub issues
๐ก Suggest features and enhancements
๐ Improve documentation
๐งช Add tests for better coverage
๐ป Submit code fixes and features
๐ Create examples and tutorials
๐ Getting Started๏
Fork the Repository
Fork the QuScope repository on GitHub and clone your fork:
git clone https://github.com/YOUR_USERNAME/quantum_algo_microscopy.git cd quantum_algo_microscopy
Set Up Development Environment
Create a virtual environment and install development dependencies:
python -m venv quscope_dev source quscope_dev/bin/activate # On Windows: quscope_dev\Scripts\activate pip install -e ".[dev,docs]"
Run Tests
Ensure everything works:
pytest tests/ python -m doctest src/quscope/image_processing/quantum_encoding.py
๐ Development Guidelines๏
Code Style
- Follow PEP 8 style guidelines
- Use Black for code formatting: black src/ tests/
- Use isort for import sorting: isort src/ tests/
- Maximum line length: 88 characters (Black default)
Documentation - Write docstrings for all public functions and classes - Use Google-style docstrings - Include usage examples in docstrings when helpful - Update documentation when adding new features
Testing - Write tests for new functionality using pytest - Aim for >90% test coverage - Include both unit tests and integration tests - Test edge cases and error conditions
Git Workflow
- Create feature branches from main
- Use descriptive commit messages
- Keep commits focused and atomic
- Include issue numbers in commit messages when applicable
๐งช Running Tests๏
# Run all tests
pytest tests/
# Run with coverage
pytest tests/ --cov=src/quscope --cov-report=html
# Run specific test file
pytest tests/test_quantum_encoding.py
# Run doctests
python -m doctest src/quscope/image_processing/quantum_encoding.py -v
๐ง Development Tools๏
Pre-commit Hooks
Set up pre-commit hooks to automatically format code:
pre-commit install
Linting
# Check code style
flake8 src/ tests/
# Type checking
mypy src/quscope/
Documentation Building
cd docs/
make html
# Open docs/_build/html/index.html
๐ Submitting Changes๏
Create a Branch
git checkout -b feature/your-feature-name
Make Changes
Write your code
Add/update tests
Update documentation
Run tests locally
Commit Changes
git add . git commit -m "Add feature: describe your changes"
Push and Create PR
git push origin feature/your-feature-name
Then create a Pull Request on GitHub.
๐ Reporting Issues๏
When reporting bugs, please include:
Environment: Python version, OS, QuScope version
Steps to reproduce: Minimal code example
Expected behavior: What should happen
Actual behavior: What actually happens
Error messages: Full traceback if applicable
๐ก Feature Requests๏
For feature requests, please describe:
Use case: Why do you need this feature?
Proposed solution: How should it work?
Alternatives: Have you considered other approaches?
Additional context: Any relevant background information
๐ท๏ธ Release Process๏
For maintainers:
Update version in
src/__init__.pyandpyproject.tomlUpdate
CHANGELOG.mdwith new features and fixesCreate a git tag:
git tag -a v0.1.0 -m "Release v0.1.0"Push tag:
git push origin v0.1.0Build and upload to PyPI:
python -m build && twine upload dist/*
๐ Getting Help๏
๐ฌ Discussions: Use GitHub Discussions for questions
๐ Issues: Report bugs via GitHub Issues
๐ง Email: Contact maintainers for sensitive issues
Thank you for contributing to QuScope! ๐