Thank you for your interest in contributing to pydantic-ai-backend!
- Python 3.10+
- uv - Fast Python package manager
- Docker (optional, for running sandbox tests)
# Clone the repository
git clone https://github.com/vstorm-co/pydantic-ai-backend.git
cd pydantic-ai-backend
# Install dependencies
uv sync --all-extras --group dev
# Run tests
uv run pytest
# Run all checks (lint, format, typecheck)
uv run ruff check .
uv run ruff format --check .
uv run pyright# Run all tests with coverage
uv run coverage run -m pytest
uv run coverage report
# Run specific test
uv run pytest tests/test_backends.py::TestStateBackend -v
# Run with debug output
uv run pytest -v -sWe use the following tools:
- ruff - Linting and formatting
- pyright - Type checking
- mypy - Additional type checking
- pytest - Testing with 100% coverage requirement
# Format code
uv run ruff format .
# Fix lint issues
uv run ruff check --fix .
# Type check
uv run pyright
uv run mypy src/pydantic_ai_backends- 100% test coverage - All new code must be covered by tests
- Type annotations - All functions must have type hints
- Passing CI - All checks must pass (lint, typecheck, tests)
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make your changes
- Run all checks locally
- Commit with a descriptive message
- Push and open a Pull Request
Follow conventional commit format:
feat: add new storage backend
fix: handle empty file content
docs: update README examples
test: add edge case coverage
src/pydantic_ai_backends/
├── __init__.py # Public API exports with lazy loading
├── types.py # FileData, FileInfo, WriteResult, EditResult, etc.
├── protocol.py # BackendProtocol, SandboxProtocol
├── state.py # StateBackend (in-memory)
├── filesystem.py # FilesystemBackend (real filesystem)
├── composite.py # CompositeBackend (routing)
├── sandbox.py # BaseSandbox, DockerSandbox, LocalSandbox
├── session.py # SessionManager
└── runtimes.py # RuntimeConfig, BUILTIN_RUNTIMES
tests/
├── test_backends.py
├── test_backends_extended.py
├── test_runtimes.py
├── test_session.py
└── test_lazy_loading.py
- Protocol-based - All backends implement
BackendProtocol - Lazy Loading - Optional dependencies (docker, pypdf, chardet) loaded on-demand
- Composable - Backends can be combined with
CompositeBackend - Type Safe - Full type annotations, strict mode compatible
Open an issue on GitHub for questions or discussions.