title: Contributing description: How to contribute to CIA : dev setup, code style, testing, adding extractors and metrics. keywords: contributing, development, guide
Contributing¶
Thank you for your interest in contributing to CIA.
Quick Start¶
- Fork the repository
- Clone your fork locally
- Create a virtual environment and install:
python -m venv .venv source .venv/bin/activate pip install -e ".[dev,all]" - Create a feature branch:
git checkout -b feature/my-feature - Make your changes, add tests, and ensure everything passes
- Commit with a clear message
- Push and open a Pull Request
Code Style¶
- Python 3.10+ with type annotations on all public functions
- 120 character line limit
- Ruff for linting and formatting
- No comments unless they explain why, not what
ruff check ciagen/ tests/
ruff format ciagen/ tests/
Testing¶
pytest # All tests
pytest tests/test_structure.py # Specific file
pytest -v # Verbose
Adding New Features¶
New Condition Extractor¶
- Create
ciagen/extractors/my_extractor.pysubclassingExtractorABC - Register in
ciagen/extractors/__init__.py - Add a ControlNet config in
ciagen/conf/config.yaml
See Custom Extractors for full details.
New Quality Metric¶
- Create
ciagen/metrics/my_metric.pysubclassingQualityMetric - Register in
ciagen/api/evaluate.py - If needed, add distance math to
ciagen/metrics/distances/
See Custom Metrics for full details.
New Feature Extractor¶
- Create
ciagen/feature_extractors/my_extractor.pysubclassingFeatureExtractor - Register in
ciagen/feature_extractors/__init__.pywith a transform function
See Custom Feature Extractors for full details.
Commit Messages¶
Use clear, imperative-style messages:
Add depth-map condition extractor
Fix FID score computation for single-batch inputs
Remove deprecated AU feature extractor
Pull Requests¶
- Keep PRs focused on a single change
- Include tests for new functionality
- Update documentation if you change public API
- Ensure
ruff checkandpytestpass before submitting
License¶
By contributing, you agree that your contributions will be licensed under the GNU AGPL v3.