Thank you for your interest in contributing to Hilbert Quantization! This document provides guidelines for contributing to the project.
-
Clone the repository:
git clone https://github.com/tylerlhess/hilbert-quantization.git cd hilbert-quantization -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install development dependencies:
pip install -e ".[dev]" -
Install pre-commit hooks:
pre-commit install
# Run all tests
pytest
# Run tests with coverage
pytest --cov=hilbert_quantization --cov-report=html
# Run only fast tests (skip slow integration tests)
pytest -m "not slow"
# Run specific test file
pytest tests/test_api.py- Unit tests: Fast, isolated component tests
- Integration tests: End-to-end workflow tests
- Benchmark tests: Performance validation tests (marked as
slow)
We use several tools to maintain code quality:
- Black: Code formatting
- isort: Import sorting
# Format code
black hilbert_quantization/ tests/
isort hilbert_quantization/ tests/- flake8: Style guide enforcement
- mypy: Type checking
# Check style
flake8 hilbert_quantization/ tests/
mypy hilbert_quantization/All formatting and linting checks run automatically on commit. To run manually:
pre-commit run --all-fileshilbert_quantization/
├── __init__.py # Main package exports
├── api.py # High-level user API
├── config.py # Configuration management
├── models.py # Data models and structures
├── exceptions.py # Custom exceptions
├── core/ # Core algorithms
│ ├── compressor.py # MPEG-AI compression
│ ├── hilbert_mapper.py # Hilbert curve mapping
│ ├── index_generator.py # Hierarchical indexing
│ ├── pipeline.py # End-to-end pipeline
│ └── search_engine.py # Similarity search
├── utils/ # Utility functions
└── video_api.py # Video-enhanced features
When reporting bugs, please include:
- Python version and OS
- Hilbert Quantization version
- Minimal code example that reproduces the issue
- Full error traceback
- Expected vs actual behavior
For new features, please:
- Describe the use case and motivation
- Provide examples of how the feature would be used
- Consider backward compatibility
- Discuss performance implications
-
Fork the repository and create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following the code style guidelines
-
Add tests for new functionality:
- Unit tests for individual components
- Integration tests for end-to-end workflows
- Update existing tests if behavior changes
-
Update documentation:
- Add docstrings for new functions/classes
- Update README if needed
- Add examples for new features
-
Run the test suite:
pytest pre-commit run --all-files
-
Submit a pull request with:
- Clear description of changes
- Reference to related issues
- Screenshots/examples if applicable
- Follow PEP 8 style guide
- Use type hints for all public functions
- Write comprehensive docstrings (Google style)
- Keep functions focused and small
- Use meaningful variable names
- Aim for >90% test coverage
- Write both positive and negative test cases
- Use descriptive test names
- Mock external dependencies
- Test edge cases and error conditions
- Use Google-style docstrings
- Include examples in docstrings
- Keep README and guides up to date
- Document breaking changes
def new_feature(parameters: np.ndarray, threshold: float = 0.5) -> Dict[str, Any]:
"""
Brief description of what this function does.
Args:
parameters: Description of parameters argument
threshold: Description of threshold with default value
Returns:
Dictionary containing results with specific keys
Raises:
ValueError: When parameters are invalid
Example:
>>> result = new_feature(np.array([1, 2, 3]))
>>> print(result['metric'])
0.75
"""
if len(parameters) == 0:
raise ValueError("Parameters cannot be empty")
# Implementation here
return {"metric": 0.75}We follow Semantic Versioning:
- MAJOR: Incompatible API changes
- MINOR: New functionality (backward compatible)
- PATCH: Bug fixes (backward compatible)
- Update version in
pyproject.tomland__init__.py - Update
CHANGELOG.md - Run full test suite
- Update documentation
- Create GitHub release
- Publish to PyPI
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Acknowledge contributions from others
- Use GitHub Issues for bug reports and feature requests
- Use GitHub Discussions for questions and general discussion
- Be patient and helpful in code reviews
- Provide context and examples in discussions
If you have questions about contributing:
- Check existing GitHub Issues
- Start a GitHub Discussion
- Email: tylerlhess@gmail.com
Thank you for contributing to Hilbert Quantization! 🎉