Thank you for your interest in contributing! This guide will help you get started with contributing to the project.
- Getting Started
- Development Setup
- Internal Development Setup
- Running Tests
- Code Style and Quality
- Adding New Functionality
- Pull Request Process
- Python 3.11, 3.12, or 3.13 (supported range is
>=3.11,<3.14inpyproject.toml) - Git
Continuous integration runs tests on Python 3.13. Slow official-model output regression tests use profiled expected fingerprints for torch 2.5.x, 2.6.x–2.9.x, and 2.10.x+ (tests/integration/test_official_models_output_regression.py); regenerate with scripts/regenerate_official_model_output_fingerprints.py if you change the numerical stack.
git clone <repository-url>
cd avex# Install the project without dev dependencies
uv sync
# For ESP users, install the project with dev dependencies
uv sync --group devThis will install:
- Base API dependencies
- Development tools (
pytest,ruff,pre-commit, etc.)
# Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in editable mode
pip install -e .
# Install dev tools
pip install pytest ruff pre-commitNote: Editable install (-e) means changes in the repo are picked up immediately without reinstalling.
Some tests that depend on optional packages (alp-data) will be automatically skipped when those packages are not installed.
For ESP team members who need access to private ESP tooling (esp-sweep) and the full training/evaluation stack:
- GCP authentication:
gcloud auth login gcloud auth application-default login
-
Install keyring with Google Artifact Registry plugin:
uv tool install keyring --with keyrings.google-artifactregistry-auth
-
Install with the full development/runtime dependency group:
uv sync --group project-dev
This installs additional dependencies:
alp-data– dataset managementesp-sweep– hyperparameter sweepingpytorch-lightning,mlflow,wandb– training infrastructure
pip install -e ".[dev]" \
--extra-index-url https://oauth2accesstoken@us-central1-python.pkg.dev/okapi-274503/esp-pypi/simple/The project uses pytest for testing. Tests are organized into three categories:
uv run pytest# Unit tests
uv run pytest tests/unittests
# Integration tests (excluding slow tests)
uv run pytest tests/integration -m "not slow"
# Evaluate pipeline metrics vs recorded baselines (requires alp_data; slow).
# Without baselines in tests/fixtures/evaluate_end_to_end_metric_baselines.json the test skips strict checks but still prints AVEX_EVAL_METRICS_SNAPSHOT.
uv run pytest tests/integration/test_run_evaluate_cross_version_metrics.py -m slow -s
# Record metrics on current Python for baseline JSON / cross-version diff:
uv run python scripts/record_evaluate_end_to_end_metrics.py record
uv run python scripts/record_evaluate_end_to_end_metrics.py diff snap_311.json snap_313.json
# Consistency tests
uv run pytest tests/consistency --base_folder avex
# Docstring tests
uv run pytest --doctest-modules avexuv run pytest --cov=avex# Run tests on CPU (default)
uv run pytest tests/unittests --device cpu
# Run tests on CUDA (if available)
uv run pytest tests/unittests --device cudauv run pytest tests/unittests/test_api_registry.pyuv run pytest -k "test_load_model"The project uses Ruff for linting and formatting. Ruff replaces black, isort, and flake8.
Key Style Guidelines:
- Line length: 88 characters (Ruff default)
- Indentation: 4 spaces (no tabs)
- Quotes: Double quotes for strings
- Import style: Absolute imports preferred over relative
- Type hints: Always use type annotations (PEP 484)
- Docstrings: Google-style docstrings required for all functions/classes
# Check code style
uv run ruff check .
# Auto-fix issues
uv run ruff check --fix .
# Format code
uv run ruff format .The project uses pre-commit hooks to ensure code quality. Install them:
uv run pre-commit installPre-commit hooks will run automatically on git commit. You can also run them manually:
uv run pre-commit run --all-files-
Create the model class in
avex/models/:- Inherit from
ModelBase - Implement required methods (
forward,get_embedding_dim, etc.) - See existing models for reference (e.g.,
beats_model.py,efficientnet.py)
- Inherit from
-
Register the model class (if using plugin architecture):
from avex import register_model_class @register_model_class class MyNewModel(ModelBase): name = "my_new_model" # ... implementation
-
Create a ModelSpec configuration:
- Add YAML config in
avex/api/configs/official_models/(if official) - Or create custom YAML config for your use case
- Add YAML config in
-
Add tests:
- Unit tests in
tests/unittests/test_<model_name>.py - Integration tests if needed in
tests/integration/
- Unit tests in
-
Update documentation:
- Add model to
docs/supported_models.md - Update API reference if needed
- Add model to
-
Create the probe class in
avex/models/probes/:- Inherit from
BaseProbe - Implement required methods
- Inherit from
-
Register the probe:
from avex.models.probes.utils import register_probe @register_probe("my_probe_type") class MyProbe(BaseProbe): # ... implementation
-
Add tests in
tests/unittests/test_base_probes.pyor create new test file
-
Add metric implementation in
avex/metrics/oravex/evaluation/ -
Add tests in
tests/unittests/test_*.py -
Update documentation if it's a public API
- Follow existing patterns: Look at similar code in the codebase
- Write tests first (TDD approach is encouraged)
- Keep functions focused: Single responsibility principle
- Add type hints: All functions must have type annotations
- Write docstrings: Google-style docstrings for all public functions/classes
- Handle errors gracefully: Use specific exception types with informative messages
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes:
- Write code following the style guidelines
- Add tests for new functionality
- Update documentation as needed
-
Run tests locally:
# Run all tests uv run pytest # Run linters uv run ruff check . uv run ruff format .
-
Ensure all tests pass:
- Unit tests
- Integration tests
- Consistency tests
- Docstring tests
-
Commit your changes:
git add . git commit -m "Add: description of your changes"
Use clear, descriptive commit messages:
Add: new feature descriptionFix: bug descriptionUpdate: what was updatedRefactor: what was refactoredDocs: documentation update
-
Push your branch:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub:
- Provide a clear title and description
- Reference any related issues
- Describe what changes you made and why
- Include any breaking changes
-
CI Checks:
- The CI will automatically run tests on your PR
- Ensure all checks pass before requesting review
-
Code Review:
- Address any feedback from reviewers
- Make additional commits if needed (they will be added to the PR)
Before submitting, ensure:
- All tests pass locally
- Code follows style guidelines (Ruff checks pass)
- Type hints are added to all functions
- Docstrings are added for all public functions/classes
- Tests are added for new functionality
- Documentation is updated if needed
- No breaking changes (or they are documented)
- Commit messages are clear and descriptive
- Documentation: Check the docs/ directory
- Issues: Open an issue on GitHub for bugs or feature requests
- Questions: Ask in pull request comments or open a discussion
- Be respectful and inclusive
- Provide constructive feedback
- Help others learn and grow
Thank you for contributing! 🎉