Contributing
Guidelines for contributing to the Co-design Platform backend.
Development Setup
# Clone
git clone git@gitlab.eurobios.com:esa/codesign/codesign-backend.git
cd codesign-backend/backend
# Virtual environment
python -m venv .venv
source .venv/bin/activate
# Install with dev dependencies
pip install -e ".[dev]"
# Start supporting services
docker compose up -d postgres litellm
# Run backend in dev mode
uvicorn backend.api.main:app --reload --port 8000
Code Style
Python 3.12+ features encouraged
Type hints on all function signatures
Async for all I/O operations
Pydantic for data validation at API boundaries
SQLAlchemy 2.0 style (select statements, not legacy query API)
Branch Strategy
main— Production-ready codedevelop— Integration branchfeature/xxx— Feature branchesfix/xxx— Bug fix branches
Workflow:
Create feature branch from
developImplement changes with tests
Run full test suite
Open merge request
Code review + CI pipeline
Merge to
develop
Adding a New API Endpoint
Define schema in
api/schemas/Add route in
api/routers/Implement service logic in
service/Add repository methods if new data access needed
Write tests in
tests/
Adding a New Agent
Create directory in
service/chat/orchestrator/agents/{agent_name}/Implement agent with prompt template and tools
Register agent in the orchestrator graph
Add routing logic in the router agent
Test with mock LLM responses
Adding a New Template Type
Define SQLAlchemy model in
models/Create repository in
database/repositories/Add template code to the service layer
Create form definition in
service/form_templates/definitions/Add API endpoints if needed
Update the corresponding agent to handle the new template
Running CI Locally
# Lint
ruff check backend/
# Type check
mypy backend/
# Tests
pytest -v
# Build Docker image
docker compose build backend