Thank you for your interest in contributing to AgentUnit! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Testing
- Documentation
- Pull Request Process
- Issue Labels
- Release Process
This project adheres to a code of conduct that all contributors are expected to follow:
- Be respectful and inclusive
- Welcome newcomers and help them get started
- Focus on constructive feedback
- Respect differing viewpoints and experiences
- Accept responsibility and apologize for mistakes
- Python 3.10 or later
- Poetry (recommended) or pip
- Git
Look for issues labeled:
good-first-issue- Great for newcomershelp-wanted- Community help neededbug- Bug fixes welcomeenhancement- Feature requestsdocumentation- Documentation improvements
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/agentunit.git
cd agentunit- Add upstream remote:
git remote add upstream https://github.com/aviralgarg05/agentunit.git- Install dependencies:
# Using Poetry (recommended)
poetry install --with dev
poetry shell
# Using pip
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e ".[dev]"- Install pre-commit hooks:
pre-commit installfeature/description- New featuresfix/description- Bug fixesdocs/description- Documentation changesrefactor/description- Code refactoringtest/description- Test additions or changeschore/description- Maintenance tasks
We use the following tools to maintain code quality:
- Ruff - Fast Python linter and formatter
- Black - Code formatting (via Ruff)
- isort - Import sorting (via Ruff)
- mypy - Type checking
Run linting and formatting:
# Format code
ruff format .
# Lint code
ruff check .
# Fix auto-fixable issues
ruff check --fix .
# Type check
mypy src/agentunitFollow conventional commits format:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat- New featurefix- Bug fixdocs- Documentation changesstyle- Code style changes (formatting, etc.)refactor- Code refactoringtest- Test additions or changeschore- Maintenance tasksperf- Performance improvements
Example:
feat(adapters): add Anthropic Bedrock adapter
Implement new adapter for AWS Bedrock runtime with Claude models.
Includes support for streaming responses and cost tracking.
Closes #123
# Run all tests
poetry run pytest
# Run with coverage
poetry run pytest --cov=agentunit --cov-report=html
# Run specific test file
poetry run pytest tests/test_adapters.py
# Run tests matching a pattern
poetry run pytest -k "test_adapter"
# Run with verbose output
poetry run pytest -v- Place tests in the
tests/directory - Name test files with
test_prefix - Name test functions with
test_prefix - Use descriptive test names that explain what is being tested
- Include docstrings for complex tests
- Use fixtures for common setup
- Aim for >80% code coverage for new code
Example:
def test_adapter_handles_timeout():
"""Test that adapter properly handles request timeout."""
adapter = MockAdapter(timeout=1)
with pytest.raises(TimeoutError):
adapter.query("test", timeout=0.5)- Update documentation for any API changes
- Add docstrings to all public classes and functions
- Include examples in docstrings
- Update README.md for user-facing changes
- Add entries to docs/ for new features
Use Google-style docstrings:
def evaluate_scenario(
scenario: Scenario,
metrics: list[Metric],
timeout: int = 30
) -> Result:
"""Evaluate a scenario against specified metrics.
Args:
scenario: The scenario to evaluate
metrics: List of metrics to compute
timeout: Maximum execution time in seconds
Returns:
Result object containing evaluation metrics and statistics
Raises:
TimeoutError: If evaluation exceeds timeout
ValueError: If scenario or metrics are invalid
Example:
>>> scenario = Scenario(name="test", ...)
>>> metrics = [ExactMatch(), Latency()]
>>> result = evaluate_scenario(scenario, metrics)
>>> print(result.success_rate)
0.85
"""# Build docs locally
cd docs
make html
# View docs
open _build/html/index.html # macOS
xdg-open _build/html/index.html # Linux
start _build/html/index.html # Windows- Update your branch with latest upstream:
git fetch upstream
git rebase upstream/main- Run tests and linting:
poetry run pytest
ruff check .
mypy src/agentunit- Update documentation if needed
- Add entry to CHANGELOG.md under "Unreleased"
- Push your branch to your fork:
git push origin your-branch-name- Create pull request on GitHub
- Fill out the PR template completely
- Link related issues
- Request review from maintainers
- Maintainers will review within 3-5 business days
- Address review comments promptly
- Keep discussions focused and professional
- Be open to feedback and suggestions
- PRs require at least one approval before merging
- Delete your branch
- Close linked issues if resolved
- Thank reviewers and collaborators
priority:critical- Blocking issues, security vulnerabilitiespriority:high- Important features or bugspriority:medium- Standard prioritypriority:low- Nice to have
bug- Something is brokenenhancement- New feature requestdocumentation- Documentation improvementsquestion- Questions about usageperformance- Performance improvementstechnical-debt- Code quality improvements
status:needs-triage- Needs initial reviewstatus:needs-info- Awaiting more informationstatus:in-progress- Being worked onstatus:blocked- Blocked by dependencystatus:wontfix- Will not be addressed
good-first-issue- Good for newcomershelp-wanted- Community help neededhacktoberfest- Valid for Hacktoberfestbreaking-change- Breaks backward compatibilitysecurity- Security related
We follow Semantic Versioning:
- MAJOR version for incompatible API changes
- MINOR version for backwards-compatible features
- PATCH version for backwards-compatible bug fixes
- Update version in
pyproject.toml - Update CHANGELOG.md with release notes
- Create release commit:
git commit -m "chore(release): bump version to X.Y.Z"- Create and push tag:
git tag -a vX.Y.Z -m "Release vX.Y.Z"
git push origin main --tags- Create GitHub release with changelog
- CI will automatically publish to PyPI (via trusted publishing)
- Check existing GitHub Issues
- Ask in GitHub Discussions
- Review documentation
Thank you for contributing to AgentUnit!