Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish to PyPI

on:
push:
tags:
- "v*"

jobs:
publish:
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv build
- uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN groupadd --system eo && useradd --system --gid eo --create-home eo
WORKDIR /app

COPY pyproject.toml uv.lock .python-version ./
COPY src/ src/
COPY climate_api/ climate_api/

RUN uv sync --frozen --no-dev

Expand Down
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2004-2025, University of Oslo
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ run: openapi ## Start the app with uvicorn
lint: ## Check linting, formatting, and types (no autofix)
uv run ruff check .
uv run ruff format --check .
uv run mypy src/
uv run mypy climate_api/
uv run pyright

fix: ## Autofix ruff lint and format issues
Expand All @@ -24,7 +24,7 @@ test: ## Run tests with pytest

openapi: ## Generate pygeoapi OpenAPI spec
@set -a && . ./.env && set +a && \
PYTHONPATH="$(PWD)/src" uv run python -c "from climate_api.publications.services import ensure_pygeoapi_base_config; ensure_pygeoapi_base_config()"
uv run python -c "from climate_api.publications.services import ensure_pygeoapi_base_config; ensure_pygeoapi_base_config()"

start: openapi ## Start the Docker stack (builds images first)
docker compose up --build
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Install dependencies (requires [uv](https://docs.astral.sh/uv/)):
uv sync
```


Copy `.env.example` to `.env` and adjust values as needed. Environment variables are loaded automatically from `.env` at runtime. See `.env.example` for the full list of available options.

Start the app:
Expand Down Expand Up @@ -110,7 +111,7 @@ else:

The OGC API is served by pygeoapi, mounted at `/ogcapi`. Its configuration is generated dynamically from published artifacts and written to the resolved runtime data directory (for Docker: `/app/data/pygeoapi/pygeoapi-config.yml`).

The base configuration is bundled with the package at `src/climate_api/data/pygeoapi/base.yml` and does not need to be copied or managed separately.
The base configuration is bundled with the package at `climate_api/data/pygeoapi/base.yml` and does not need to be copied or managed separately.

To validate the configuration manually:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 22 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@
requires = ["uv_build>=0.9.0"]
build-backend = "uv_build"

[tool.uv.build-backend]
module-root = ""

[project]
name = "climate-api"
version = "0.1.0a1"
requires-python = ">=3.13"
description = "Climate and Earth Observation data API for DHIS2"
description = "Climate and Earth Observation data API"
license = { text = "BSD-3-Clause" }
authors = [{ name = "University of Oslo", email = "climate@dhis2.org" }]
readme = "README.md"
keywords = ["dhis2", "climate", "zarr", "stac", "geospatial"]
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: GIS",
]
dependencies = [
"fastapi>=0.100.0",
"jinja2>=3.1",
Expand All @@ -15,7 +28,6 @@ dependencies = [
"python-dotenv>=1.0.1",
"pygeoapi>=0.22.0",
"pystac>=1.10,<2",
"dhis2eo==1.2.1",
"geojson-pydantic>=2.1.0",
"httpx>=0.28.1",
"earthkit-transforms==0.5.*",
Expand All @@ -26,6 +38,10 @@ dependencies = [
"topozarr==0.0.*",
]

[project.urls]
Repository = "https://github.com/dhis2/climate-api"
Documentation = "https://github.com/dhis2/climate-api/tree/main/docs"

[project.scripts]
climate-api = "climate_api.cli:main"

Expand All @@ -44,7 +60,7 @@ convention = "google"
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["D"]
"**/__init__.py" = ["D104"]
"src/**/*.py" = ["D102", "D105", "D107"]
"climate_api/**/*.py" = ["D102", "D105", "D107"]

[tool.ruff.format]
quote-style = "double"
Expand All @@ -63,18 +79,18 @@ check_untyped_defs = true
no_implicit_optional = true
warn_unused_ignores = true
strict_equality = true
mypy_path = ["src"]
mypy_path = ["."]

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false

[[tool.mypy.overrides]]
module = ["dhis2eo.*", "pygeoapi.*", "rasterio.*", "pygeofilter.*", "requests.*", "geopandas.*", "earthkit.*", "metpy.*", "matplotlib.*", "yaml", "xproj", "topozarr.*", "geozarr_toolkit", "xstac"]
module = ["pygeoapi.*", "rasterio.*", "pygeofilter.*", "requests.*", "geopandas.*", "earthkit.*", "metpy.*", "matplotlib.*", "yaml", "xproj", "topozarr.*", "geozarr_toolkit", "xstac"]
ignore_missing_imports = true

[tool.pyright]
include = ["src", "tests"]
include = ["climate_api", "tests"]
exclude = ["**/.venv"]
pythonVersion = "3.13"
typeCheckingMode = "strict"
Expand Down
113 changes: 0 additions & 113 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading