Goal
pip install climate-api installs a working Climate API instance. The package name is available on PyPI.
Current state
pyproject.toml already has name = "climate-api", version = "0.1.0", a description, and a climate-api console script entry point.
- The package is not published anywhere yet.
Blockers to resolve
1. Git-sourced dependencies must be on PyPI
Two runtime dependencies are pinned to GitHub branches and cannot ship in a PyPI release:
"dhis2eo @ git+https://github.com/dhis2/dhis2eo.git@v1.2.0",
"dhis2-client @ git+https://github.com/dhis2/dhis2-python-client.git@V0.3.0",
Both packages must be published to PyPI with matching version tags before climate-api can be released. Coordinate with the owners of those repos, or vendor the relevant modules if a release is not feasible.
2. Bundle the built-in dataset YAMLs as package data
The built-in templates in data/datasets/ are currently located outside the installable src/climate_api/ tree, referenced by a __file__-relative path in data_registry/services/datasets.py. An installed wheel will not include data/.
Steps:
- Move
data/datasets/ to src/climate_api/datasets/ (or another path inside the package).
- Add it to the wheel via
pyproject.toml:
[tool.uv_build]
include = ["src/climate_api/datasets/**"]
- Update
_BUILTIN_DATASETS_DIR in datasets.py to use importlib.resources instead of __file__:
from importlib.resources import files
_BUILTIN_DATASETS_DIR = files("climate_api") / "datasets"
3. Bundle the pygeoapi base config
config/pygeoapi/ is also outside the package. Either move it inside src/climate_api/config/pygeoapi/ and include it as package data, or make the path configurable via an environment variable with a sensible fallback using importlib.resources.
4. Complete package metadata
Add the missing fields to pyproject.toml so the PyPI page is useful:
[project]
license = { text = "BSD-2-Clause" } # confirm correct license
authors = [{ name = "DHIS2", email = "..." }]
readme = "README.md"
keywords = ["dhis2", "climate", "zarr", "stac", "geospatial"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD Software License",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: GIS",
]
[project.urls]
Repository = "https://github.com/dhis2/climate-api"
Documentation = "https://github.com/dhis2/climate-api/tree/main/docs"
5. Publish workflow
Add a GitHub Actions workflow that builds and publishes to PyPI on tagged releases (using Trusted Publishing — no API token needed):
# .github/workflows/publish.yml
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
Configure the pypi environment in the repo settings and add the project on PyPI under Trusted Publishing.
6. Verify install in a clean environment
Before the first release:
uv venv /tmp/test-install && source /tmp/test-install/bin/activate
pip install .
climate-api # should start the server
Out of scope for this issue
- Runtime data directories (
data/downloads/, data/pygeoapi/) — these are instance-specific and already handled by environment variables (CACHE_OVERRIDE, PYGEOAPI_CONFIG). No change needed.
- The
climate-api.yaml instance config — installed users are expected to create their own.
Goal
pip install climate-apiinstalls a working Climate API instance. The package name is available on PyPI.Current state
pyproject.tomlalready hasname = "climate-api",version = "0.1.0", a description, and aclimate-apiconsole script entry point.Blockers to resolve
1. Git-sourced dependencies must be on PyPI
Two runtime dependencies are pinned to GitHub branches and cannot ship in a PyPI release:
Both packages must be published to PyPI with matching version tags before
climate-apican be released. Coordinate with the owners of those repos, or vendor the relevant modules if a release is not feasible.2. Bundle the built-in dataset YAMLs as package data
The built-in templates in
data/datasets/are currently located outside the installablesrc/climate_api/tree, referenced by a__file__-relative path indata_registry/services/datasets.py. An installed wheel will not includedata/.Steps:
data/datasets/tosrc/climate_api/datasets/(or another path inside the package).pyproject.toml:_BUILTIN_DATASETS_DIRindatasets.pyto useimportlib.resourcesinstead of__file__:3. Bundle the pygeoapi base config
config/pygeoapi/is also outside the package. Either move it insidesrc/climate_api/config/pygeoapi/and include it as package data, or make the path configurable via an environment variable with a sensible fallback usingimportlib.resources.4. Complete package metadata
Add the missing fields to
pyproject.tomlso the PyPI page is useful:5. Publish workflow
Add a GitHub Actions workflow that builds and publishes to PyPI on tagged releases (using Trusted Publishing — no API token needed):
Configure the
pypienvironment in the repo settings and add the project on PyPI under Trusted Publishing.6. Verify install in a clean environment
Before the first release:
Out of scope for this issue
data/downloads/,data/pygeoapi/) — these are instance-specific and already handled by environment variables (CACHE_OVERRIDE,PYGEOAPI_CONFIG). No change needed.climate-api.yamlinstance config — installed users are expected to create their own.