Contributing to AdaptShot¶
Thank you for your interest in contributing to AdaptShot. This document outlines how to contribute code, documentation, or feedback in a way that aligns with our mission: building trustworthy, CPU-first few-shot vision AI for resource-constrained environments.
π― Our Guiding Principles¶
- Truth over hype: We document what works, what doesn't, and why. No exaggerated claims.
- CPU-first by default: All new features must run on CPU with <250MB RAM unless explicitly marked as optional GPU extras.
- Human-in-the-loop by design: Contributions should enhance transparency, calibration, or feedback routingβnot obscure them.
- Open and reproducible: Every benchmark, test, and result must be reproducible with
pytest,mypy, and our benchmark harnesses.
π οΈ Getting Started¶
Prerequisites¶
- Python β₯ 3.9
- Git
- Virtual environment tool (
venv,virtualenv, orconda)
Setup¶
# 1. Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/adaptshot.git
cd adaptshot
# 2. Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# 3. Install development dependencies
pip install -e ".[dev]"
# 4. Install pre-commit hooks (optional but recommended)
pre-commit install
Verify Your Setup¶
# Run tests
pytest tests/ -v
# Run type checking
mypy src/adaptshot --strict
# Run linting
ruff check src/adaptshot tests/
# Run smoke benchmark
python -m benchmarks.run_benchmark --smoke-test
π¦ Project Structure¶
adaptshot/
βββ src/adaptshot/ # Core library code
β βββ config/ # Configuration dataclasses
β βββ core/ # Inference engine (extractor, similarity, calibration, ACT, learner)
β βββ training/ # Continual learning (feedback_router, finetune, up_ugf)
β βββ ui/ # Gradio interface for pilots
β βββ utils/ # Determinism, I/O helpers
βββ benchmarks/ # Reproducible evaluation scripts
βββ tests/ # Unit and integration tests
βββ docs/ # Documentation source (MkDocs)
βββ pyproject.toml # Build config, dependencies, tool settings
βββ README.md # Project overview
βββ CONTRIBUTING.md # This file
βββ CODE_OF_CONDUCT.md # Community standards
βββ CHANGELOG.md # Version history
π§ͺ Testing Guidelines¶
- All new code must include unit tests in
tests/usingpytest. - Type hints are required on all public functions and classes (
mypy --strictenforced). - Benchmarks must be deterministic: Use
set_deterministic_seed()and verify withverify_determinism(). - CPU-first validation: New features must pass benchmarks on CPU unless explicitly marked GPU-only.
Example test structure:
# tests/test_new_module.py
import pytest
from src.adaptshot.new_module import NewComponent
def test_new_component_basic():
comp = NewComponent(param=42)
result = comp.run()
assert result is not None
assert isinstance(result, ExpectedType)
π Code Style¶
- Formatting: Ruff auto-formatter (
ruff check --fix) - Imports: Standard library β third-party β local (sorted alphabetically)
- Docstrings: Google-style for public APIs; concise one-liners for private helpers
- Line length: β€100 characters
- Logging: Use
logging.getLogger(__name__)instead ofprint()for library code
π Contribution Workflow¶
- Create a feature branch:
git checkout -b feat/your-feature-name - Make changes: Follow testing and style guidelines above
- Run full validation:
- Commit with clear messages:
- Push and open a Pull Request:
- Link to relevant issue or discussion
- Describe what changed and why
- Include benchmark diffs if performance/calibration affected
- Add
[WIP]prefix if work is incomplete
π£οΈ Communication¶
- Discussions: Use GitHub Discussions for questions, ideas, and RFCs
- Issues: Report bugs or request features via GitHub Issues
- WhatsApp: Join our community WhatsApp group for real-time discussion
- Security: Report vulnerabilities privately to johnson2006christopher@gmail.com
- Code of Conduct: All interactions follow our Code of Conduct
π Documentation¶
- API docs: Auto-generated from docstrings via MkDocs + mkdocstrings
- Tutorials: Jupyter notebooks in
docs/tutorials/with executable examples - Examples: Minimal runnable scripts in
docs/examples/
To preview docs locally:
π« What We Don't Accept¶
- Features that require GPU by default without a CPU fallback
- Undocumented public APIs or missing type hints
- Benchmarks that aren't reproducible with
--seed 42 - Marketing language or unsubstantiated performance claims
- Code that violates our CPU-first, <250MB RAM constraint for core functionality
π Thank You¶
Every contributionβcode, docs, testing, or feedbackβhelps make trustworthy AI accessible to more people. We review all PRs within 7 days and provide constructive feedback.
If you're unsure where to start, look for issues labeled good first issue or open a Discussion to propose an idea.
β The AdaptShot Maintainers
Created by Johnson Christopher Hassan
Connect on LinkedIn
Project: github.com/johnson2006christopher/adaptshot