Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
68646c2
Add uv-lock to pre-commit hooks
peanutfun Apr 30, 2026
017b804
Update dependency groups and add uv.lock
peanutfun Apr 30, 2026
7f1f80e
Update GitHub actions and readthedocs config
peanutfun Apr 30, 2026
dd0b8f3
ci: Fix setup-uv version
peanutfun Apr 30, 2026
8f22d94
readthedocs: Install libgdal via APT
peanutfun Apr 30, 2026
3af8041
Invoke uv via Makefile
peanutfun Apr 30, 2026
f95a1bc
rtd: Use latest Ubuntu LTS
peanutfun Apr 30, 2026
9a43de2
rtd: Try conda again
peanutfun Apr 30, 2026
5bb73b1
Require pandas <3.0
peanutfun Apr 30, 2026
3cd2b03
pre-commit: Add hook exporting doc requirements
peanutfun Apr 30, 2026
4bf46e2
rtd: Use exported requirements.txt for installation
peanutfun Apr 30, 2026
443aa67
rtd: Add environment file for docs referencing requirements
peanutfun Apr 30, 2026
dc893e6
Move doc environment file
peanutfun Apr 30, 2026
9195a68
rtd: Fix file path
peanutfun Apr 30, 2026
6732de6
rtd: Add Python version to conda environment
peanutfun Apr 30, 2026
9db855c
Add numpy as extra to gdal dependency
peanutfun Jun 3, 2026
caa8c9a
Install openssl in base conda image
peanutfun Jun 3, 2026
f2574bd
Try GDAL v3.13
peanutfun Jun 3, 2026
f64dfba
Avoid GDAL binaries
peanutfun Jun 3, 2026
ccda0fe
uv: Use non-managed Python, try to build gdal and rasterio
peanutfun Jun 4, 2026
e896359
ci: Install Python with micromamba
peanutfun Jun 4, 2026
6413b88
Use rasterio instead of gdal for file reading
peanutfun Jun 5, 2026
7314c01
Remove gdal from dependencies
peanutfun Jun 5, 2026
8f728bc
ci: Stop using mamba, install make
peanutfun Jun 5, 2026
231491d
ci: Fix action version
peanutfun Jun 5, 2026
633f782
Merge branch 'develop' into add-uv-config
peanutfun Jun 8, 2026
9c4a872
Consolidate requirements for pure pip install
peanutfun Jun 8, 2026
196cdd4
Fix integration tests
peanutfun Jun 8, 2026
89a9f34
rtd: Switch to uv
peanutfun Jun 8, 2026
608428a
ci: Add pipeline for integration tests
peanutfun Jun 8, 2026
3976e60
ci: Configure data dir and cache data
peanutfun Jun 8, 2026
f997051
ci: Fix 'unzip' command
peanutfun Jun 8, 2026
c5aa047
Remove pre-commit hook for doc requirements
peanutfun Jun 8, 2026
292fddf
ci: Try adapting climada.conf
peanutfun Jun 8, 2026
f322b0f
ci: Update Zenodo DOI and try debugging unzip
peanutfun Jun 8, 2026
236f854
ci: Fix configuration file paths
peanutfun Jun 8, 2026
e804207
ci: Update Zenodo DOI
peanutfun Jun 8, 2026
8dd69a5
ci: Fix Zenodo DOI
peanutfun Jun 8, 2026
14c6b67
Add script and pre-commit hook for compiling Conda env
peanutfun Jun 10, 2026
2f04c95
Remove optional dependencies
peanutfun Jun 10, 2026
307f5ac
Make conda-env hook not use uv
peanutfun Jun 10, 2026
c0d5208
ci: Overwrite when unzipping
peanutfun Jun 18, 2026
687d586
ci: Cache the Zenodo download, not the unzipped files
peanutfun Jun 18, 2026
10b4d1e
Fix integration tests
peanutfun Jun 18, 2026
a1ea4e7
Use pip install for unit tests. Require integration tests to pass
peanutfun Jun 18, 2026
6a0ff2e
ci: Use plain pip for unit tests
peanutfun Jun 18, 2026
01ab7f9
Remove uv commands from Makefile
peanutfun Jun 18, 2026
1d62420
ci: Update test results reporting
peanutfun Jun 18, 2026
fb097f9
ci: Fix bug in version specs
peanutfun Jun 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 122 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,91 @@ defaults:
run:
shell: bash -el {0}

env:
CLIMADA_DATA_DOI: 10.5281/zenodo.20595842

jobs:
integration-test:
name: 'Core / Integration Test Pipeline'
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
-
name: Checkout Repo
uses: actions/checkout@v4

# --- Modify paths in climada.conf ---
-
name: Write climada.conf system data
uses: amochkin/action-json@v1
with:
mode: write
file: climada.conf
property: local_data.system
value: ${{ github.workspace }}/climada/data
-
name: Write climada.conf demo data
uses: amochkin/action-json@v1
with:
mode: write
file: climada.conf
property: local_data.demo
value: ${{ github.workspace }}/climada/demo
-
run: |
cat climada.conf
# ---

-
name: Install make
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: make
-
name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.12"
cache-suffix: integrationtest
-
name: Install dependencies
run: |
uv sync --locked --dev
-
name: Cache data
uses: actions/cache@v5
with:
path: climada.zip
key: ${{ env.CLIMADA_DATA_DOI }}
-
name: Download and unzip data
run: |
uvx zenodo_get ${{ env.CLIMADA_DATA_DOI }}
unzip -o climada.zip -d ${{ github.workspace }}
-
name: Run Integration Tests
run: |
uv run -- make integ_test
-
name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: Test Results (Python ${{ matrix.python-version }})
path: tests_xml/tests.xml
-
name: Upload Coverage Reports
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: Coverage Report Integration Tests (Python ${{ matrix.python-version }})
path: coverage/

build-and-test:
name: 'Core / Unit Test Pipeline'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
# For publishing results
checks: write

# Run this test for different Python versions
strategy:
Expand All @@ -34,40 +111,62 @@ jobs:
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
-
name: Create Environment with Mamba
uses: mamba-org/setup-micromamba@v1
name: Install make
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: make
-
name: Install Python
uses: actions/setup-python@v6
with:
environment-name: climada_env_${{ matrix.python-version }}
environment-file: requirements/env_climada.yml
create-args: >-
python=${{ matrix.python-version }}
make
# Persist environment for branch, Python version, single day
cache-environment-key: env-${{ github.ref }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}
-
name: Install CLIMADA
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
-
name: Install dependencies
run: |
python -m pip install "./[dev]"
pip install --upgrade pip
pip install -e ./
pip install --group dev
-
name: Run Unit Tests
run: |
make unit_test
-
name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
junit_files: tests_xml/tests.xml
check_name: "Core / Unit Test Results (${{ matrix.python-version }})"
comment_mode: "off"
name: test-results-core-unittests-py${{ matrix.python-version }}
path: tests_xml/tests.xml
-
name: Upload Coverage Reports
if: always()
uses: actions/upload-artifact@v4
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: coverage-report-core-unittests-py${{ matrix.python-version }}
path: coverage/

publish-test-results:
name: "Core / Publish Test Results"
needs: [build-and-test, integration-test]
runs-on: ubuntu-latest
permissions:
checks: write
steps:
-
name: Download Test Results
uses: actions/download-artifact@v8
with:
pattern: test-results-core-unittests-py*
path: results
-
name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "results/**/*.xml"
check_name: "Core / Test Results"
comment_mode: "off"

test-petals:
name: Petals Compatibility
uses: CLIMADA-project/climada_petals/.github/workflows/testing.yml@develop
Expand Down
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,19 @@ repos:
rev: '24.4.2'
hooks:
- id: black-jupyter

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.7
hooks:
- id: uv-lock

- repo: local
hooks:
- id: conda-env
name: Compile Conda Environment
entry: python script/make_conda_env.py
language: python
files: pyproject.toml
pass_filenames: false
additional_dependencies:
- PyYAML
18 changes: 5 additions & 13 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@ sphinx:
configuration: doc/conf.py

build:
os: "ubuntu-22.04"
os: "ubuntu-26.04"
tools:
python: "mambaforge-4.10"

# Append fixed Python version to requirements
jobs:
pre_create_environment:
- echo " - python=3.11" >> requirements/env_climada.yml

conda:
environment: requirements/env_climada.yml
python: "3.12"

python:
install:
- method: pip
path: .
extra_requirements:
- method: uv
command: sync
groups:
- doc

formats:
Expand Down
10 changes: 3 additions & 7 deletions climada/entity/exposures/litpop/nightlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import rasterio
import scipy.sparse as sparse
from affine import Affine
from osgeo import gdal
from PIL import Image
from shapefile import Shape

Expand Down Expand Up @@ -479,7 +478,7 @@ def load_nightlight_nasa(bounds, req_files, year):
continue
extent = np.int64(np.clip(extent, 0, tile_size[None] - 1))
# pylint: disable=unsubscriptable-object
im_nl, _ = read_bm_file(SYSTEM_DIR, fname % (year))
im_nl = read_bm_file(SYSTEM_DIR, fname % (year))
im_nl = np.flipud(im_nl)
im_nl = sparse.csc.csc_matrix(im_nl)
im_nl = im_nl[extent[0, 0] : extent[1, 0] + 1, extent[0, 1] : extent[1, 1] + 1]
Expand Down Expand Up @@ -512,18 +511,15 @@ def read_bm_file(bm_path, filename):
-------
arr1 : array
Raw BM data
curr_file : gdal GeoTiff File
Additional info from which coordinates can be calculated.
"""
path = Path(bm_path, filename)
LOGGER.debug("Importing%s.", path)
if not path.exists():
raise FileNotFoundError(
"Invalid path: check that the path to BlackMarble file is correct."
)
curr_file = gdal.Open(str(path))
arr1 = curr_file.GetRasterBand(1).ReadAsArray()
return arr1, curr_file
curr_file = rasterio.open(path)
return curr_file.read(1)


def unzip_tif_to_py(file_gz):
Expand Down
2 changes: 1 addition & 1 deletion climada/test/test_litpop_integr.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_switzerland30normPop_pass(self):
self.assertIn("LitPop: Init Exposure for country: CHE", cm.output[0])
self.assertEqual(ent.region_id.min(), 756)
self.assertEqual(ent.region_id.max(), 756)
self.assertEqual(ent.value.sum(), 1.0)
self.assertAlmostEqual(ent.value.sum(), 1.0)
self.assertEqual(ent.ref_year, 2015)

def test_suriname30_nfw_pass(self):
Expand Down
Loading
Loading