Dev Experience
This section provides guidance for developers working with the AClimate v3 ecosystem.
Repository Structure
All repositories follow a consistent structure:
aclimate_v3_<component>/
├── src/ # Source code
├── tests/ # Test suite
├── Dockerfile # Container definition
├── dockerignore # Docker build exclusions
├── Jenkinsfile # CI/CD pipeline
├── README.md # Component documentation
├── requirements.txt # Python dependencies (if applicable)
├── pyproject.toml/package.json # Project metadata
└── .github/ # GitHub workflows/templates
Setup Local Environment
Prerequisites
- Python 3.10+ (for API, ORM, ETL, Admin)
- Node.js 20+ (for Frontend)
- Docker (for containerized development)
- PostgreSQL 14+ (for database)
- Git (version control)
Python Components (API, ORM, ETL, Admin)
# Clone the repository
git clone https://github.com/CIAT-DAPA/aclimate_v3_<component>.git
cd aclimate_v3_<component>
# Create virtual environment
python -m venv env
source env/bin/activate # Linux/Mac
# or: env\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt # Optional: dev dependencies
Frontend
# Clone and setup
git clone https://github.com/CIAT-DAPA/aclimate_v3_frontend.git
cd aclimate_v3_frontend
npm install
npm run dev # Development server
ORM Package (used by all Python components)
# Install in development mode
cd aclimate_v3_orm
pip install -e .
Environment Variables
Each component uses environment variables for configuration. Key variables:
| Variable | Component | Description |
|---|---|---|
DATABASE_URL | All Python | PostgreSQL connection string |
API_URL | Frontend/Admin | WebAPI endpoint URL |
SECRET_KEY | WebAPI | JWT signing secret |
ENVIRONMENT | All | Deployment environment |
LOG_LEVEL | All | Logging verbosity |
CORS_ORIGINS | WebAPI | Allowed CORS origins |
Coding Standards
Python
- Follow PEP 8 style guide
- Use type hints for all function signatures
- Docstrings follow Google style
- Linting:
flake8orruff - Formatting:
black
TypeScript
- Follow project ESLint configuration
- Use strict TypeScript mode
- Formatting: Prettier
- Component organization: Feature-based folders
Testing Strategy
| Level | Tools | Scope |
|---|---|---|
| Unit | pytest (Python), Jest (TS) | Individual functions and services |
| Integration | pytest + test DB | API endpoints, service layer |
| E2E | Playwright (Frontend) | Full user workflows |
| Data | pytest (ORM) | Model validations, schema integrity |
Running Tests
# Python components
pytest tests/ -v
# Frontend
npm run test
# With coverage
pytest tests/ --cov=src/ -v
Common Development Tasks
Adding a New Database Migration
cd aclimate_v3_orm
alembic revision --autogenerate -m "description"
alembic upgrade head
Running the API Locally
cd aclimate_v3_webapi
uvicorn src.main:app --reload --port 8000
Building Docker Images
docker build -t aclimate-v3-<component>:latest .
CI/CD Pipeline
All repositories use Jenkins for CI/CD with a standard pipeline:
- Checkout: Clone repository
- Install dependencies: npm/pip
- Lint: Code quality checks
- Test: Run test suite
- Build: Build artifacts/Docker image
- Deploy: Push to environment (dev → qa → prod)
Git Workflow
- Branching: Feature branches from
develop, merge via PR - Commit messages: Conventional commits format
- PR requirements: Tests passing, lint clean, review approval
- Release: Tag-based releases from
mainbranch