Skip to main content

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:

VariableComponentDescription
DATABASE_URLAll PythonPostgreSQL connection string
API_URLFrontend/AdminWebAPI endpoint URL
SECRET_KEYWebAPIJWT signing secret
ENVIRONMENTAllDeployment environment
LOG_LEVELAllLogging verbosity
CORS_ORIGINSWebAPIAllowed CORS origins

Coding Standards​

Python​

  • Follow PEP 8 style guide
  • Use type hints for all function signatures
  • Docstrings follow Google style
  • Linting: flake8 or ruff
  • Formatting: black

TypeScript​

  • Follow project ESLint configuration
  • Use strict TypeScript mode
  • Formatting: Prettier
  • Component organization: Feature-based folders

Testing Strategy​

LevelToolsScope
Unitpytest (Python), Jest (TS)Individual functions and services
Integrationpytest + test DBAPI endpoints, service layer
E2EPlaywright (Frontend)Full user workflows
Datapytest (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:

  1. Checkout: Clone repository
  2. Install dependencies: npm/pip
  3. Lint: Code quality checks
  4. Test: Run test suite
  5. Build: Build artifacts/Docker image
  6. 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 main branch