Thank you for your interest in contributing to the DevRev Python SDK! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Environment
- Code Standards
- Branch Naming Conventions
- Commit Message Format
- Pull Request Process
- Testing Requirements
- Documentation
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/py-dev-rev.git cd py-dev-rev - Add upstream remote:
git remote add upstream https://github.com/mgmonteleone/py-dev-rev.git
- Python 3.11 or higher
- uv (recommended) or pip
- Git
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install# Copy environment template
cp .env.sample .env
# Edit .env with your DevRev API credentials
# DEVREV_API_TOKEN=your-token-hereWe maintain high code quality standards using automated tools.
We use Ruff for both linting and formatting:
# Format code
ruff format .
# Check for linting issues
ruff check .
# Auto-fix linting issues
ruff check --fix .We use mypy for static type checking:
# Run type checker
mypy src/
# Type checking is strict - all code must have type annotationsPre-commit hooks run automatically before each commit:
# Run all hooks manually
pre-commit run --all-files
# Update hooks to latest versions
pre-commit autoupdateAll code must:
- ✅ Pass
ruff checkwith no errors - ✅ Pass
ruff format --check(properly formatted) - ✅ Pass
mypy src/with no errors - ✅ Have type annotations for all functions and methods
- ✅ Follow Google-style docstrings
- ✅ Have 80%+ test coverage for new code
Use descriptive branch names with the following prefixes:
feature/- New features (e.g.,feature/add-webhook-support)fix/- Bug fixes (e.g.,fix/pagination-error)docs/- Documentation updates (e.g.,docs/improve-readme)refactor/- Code refactoring (e.g.,refactor/simplify-auth)test/- Test improvements (e.g.,test/add-integration-tests)chore/- Maintenance tasks (e.g.,chore/update-dependencies)
We follow Conventional Commits:
<type>(<scope>): <subject>
<body>
<footer>
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, no logic change)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasksperf: Performance improvementsci: CI/CD changes
feat(client): add support for custom retry strategies
Implement configurable retry strategies with exponential backoff.
Users can now customize retry behavior for failed API calls.
Closes #123
fix(pagination): handle empty result sets correctly
Previously, pagination would fail when API returned empty results.
Now properly handles edge case and returns empty list.
Fixes #456
- Use present tense ("add feature" not "added feature")
- Use imperative mood ("move cursor to..." not "moves cursor to...")
- Limit first line to 72 characters
- Reference issues and PRs in footer
- Include breaking changes in footer with
BREAKING CHANGE:prefix
-
Update from upstream:
git fetch upstream git rebase upstream/main
-
Run all checks:
# Format and lint ruff format . ruff check --fix . # Type check mypy src/ # Run tests pytest # Check coverage pytest --cov=src/devrev --cov-report=term-missing
-
Update documentation if needed
-
Add tests for new features
-
Update CHANGELOG.md (if applicable)
- Push your branch to your fork
- Create a Pull Request against
main - Fill out the PR template completely
- Link related issues
- Request review from maintainers
- ✅ All CI checks pass
- ✅ Code review approved
- ✅ Tests pass with 80%+ coverage
- ✅ Documentation updated
- ✅ No merge conflicts
- ✅ Commits follow conventional format
- Automated checks run (CI/CD)
- Code review by maintainers
- Address feedback and update PR
- Final approval and merge
- Minimum 80% coverage for all new code
- 100% coverage for critical paths (authentication, API calls)
- Both unit and integration tests required
# Run all tests
pytest
# Run with coverage
pytest --cov=src/devrev --cov-report=html
# Run specific test file
pytest tests/unit/test_client.py
# Run integration tests only
pytest -m integration
# Run with verbose output
pytest -v- Use
pytestframework - Follow existing test patterns
- Mock external API calls in unit tests
- Use fixtures for common setup
- Test both success and error cases
- Include edge cases
tests/
├── unit/ # Fast, isolated tests
├── integration/ # Tests with real API calls
└── conftest.py # Shared fixtures
Use Google-style docstrings:
def create_work_item(
title: str,
description: str | None = None,
) -> WorkItem:
"""Create a new work item in DevRev.
Args:
title: The title of the work item.
description: Optional detailed description.
Returns:
The created WorkItem instance.
Raises:
ValidationError: If title is empty or invalid.
APIError: If the API request fails.
Example:
>>> client = DevRevClient()
>>> work = client.create_work_item("Fix login bug")
>>> print(work.id)
"""- Update docstrings for all public APIs
- Add examples for new features
- Update
docs/directory if needed - Keep README.md current
- 📧 Email: matthewm@augmentcode.com
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
Thank you for contributing! 🎉