Overview
The Avaliar Python SDK is open source and welcomes contributions. This guide covers everything you need to get a local development environment running, submit changes, and follow the project’s code standards. Repository: github.com/avaliar-ai/python-sdkPrerequisites
| Requirement | Version | Notes |
|---|---|---|
| Python | 3.13+ | Required. Earlier versions are not supported. |
| Git | Any | For cloning and branching. |
uv | Latest | Recommended package manager. See install instructions below. |
Install uv
The SDK project usesuv for dependency management. Install it with:
Setup
1. Fork and Clone
Fork the repo on GitHub, then clone your fork:2. Install dependencies
Install the package in editable mode with development dependencies:mypy, ruff, and pre-commit.
Alternatively, using pip:
3. Install pre-commit hooks
4. Set environment variables
Project Structure
Dev Commands
Run these from the project root:Code Standards
Formatting and Linting
The project usesruff for both linting and formatting. Key settings (from pyproject.toml):
- Line length: 79 characters
- Quote style: double quotes
- Python target: 3.13
ruff format avaliar/ before committing. Pre-commit does this automatically.
Type Annotations
All functions must have complete type annotations. The project usesmypy in strict mode with pydantic plugin:
mypy avaliar/ to check before committing. Pre-commit does this automatically.
No bare except
Always catch specific exceptions or at minimum Exception:
Public API surface
The public API is whatever is exported fromavaliar/__init__.py. Currently:
__init__.py and document it.
Making Changes
Branch naming
Commit style
Use short, descriptive commit messages in the imperative mood:Pull Requests
- Make sure
pre-commit run --all-filespasses cleanly - Add or update docstrings for any new or changed public methods
- Include a short description of what changed and why
- Link any relevant issues
Adding a New Benchmark
Benchmarks live inavaliar/benchmarks/. To add one:
- Create a new directory:
avaliar/benchmarks/your_benchmark/ - Implement
task.py(an enum of benchmark tasks),template.py(prompt formatting), andyour_benchmark.py(the main class) - Inherit from
BaseBenchmarkand implementload_benchmark_dataset()andevaluate() - Export from
avaliar/benchmarks/__init__.py
Adding a New Detector
Detectors are provided by theavaliar_eval package (a separate dependency). The SDK itself does not implement detection algorithms — it routes data to avaliar_eval and handles the results.
If you want to extend detection, contribute to the avaliar_eval package or open an issue describing the new detector type.
Troubleshooting Local Setup
ModuleNotFoundError: No module named 'avaliar_eval'
The detection engine is a separate package. Install it:
mypy errors on build directory
The build/ directory is excluded from mypy checks by default in pyproject.toml. If you see errors there, ensure your mypy config matches: