From 75df2856c79894efd0d1629c9deeefb14d3b89da Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Sun, 18 Oct 2026 16:33:35 -0400 Subject: [PATCH 1/4] add scheduled run to trivy CI and update dependencies --- .github/workflows/main.yml | 1 + .github/workflows/{vulnerabilities.yml => trivy.yml} | 6 ++++-- README.md | 2 +- docs/source/development.rst | 2 +- requirements-docker.txt | 4 ++-- requirements-provider.txt | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) rename .github/workflows/{vulnerabilities.yml => trivy.yml} (89%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f90ba4d6bc..614481c895 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -131,6 +131,7 @@ jobs: pip3 install . pip3 install GDAL==`gdal-config --version` pip3 install "pyproj<3.8" + pip3 install "SQLAlchemy==2.0.54" - name: setup test data ⚙️ run: | pybabel compile -d locale -l es diff --git a/.github/workflows/vulnerabilities.yml b/.github/workflows/trivy.yml similarity index 89% rename from .github/workflows/vulnerabilities.yml rename to .github/workflows/trivy.yml index 3c3e0ed251..1d8e97ad0d 100644 --- a/.github/workflows/vulnerabilities.yml +++ b/.github/workflows/trivy.yml @@ -12,6 +12,8 @@ on: release: types: - released + schedule: + - cron: '0 8 * * *' # runs daily at 8h UTC jobs: @@ -24,7 +26,7 @@ jobs: - name: Checkout pygeoapi uses: actions/checkout@master - name: Scan vulnerabilities with trivy - uses: aquasecurity/trivy-action@v0.35.0 + uses: aquasecurity/trivy-action@v0.36.0 with: scan-type: fs exit-code: 1 @@ -39,7 +41,7 @@ jobs: run: | docker buildx build -t ${{ env.IMAGE_NAME }}:${{ github.sha }} --platform linux/amd64 --no-cache -f Dockerfile . - name: Scan locally built Docker image for vulnerabilities with trivy - uses: aquasecurity/trivy-action@v0.35.0 + uses: aquasecurity/trivy-action@v0.36.0 env: TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2 TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db:1 diff --git a/README.md b/README.md index d0d8c8a506..b2ed3036e7 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![DOI](https://zenodo.org/badge/121585259.svg)](https://zenodo.org/badge/latestdoi/121585259) [![Build](https://github.com/geopython/pygeoapi/actions/workflows/main.yml/badge.svg)](https://github.com/geopython/pygeoapi/actions/workflows/main.yml) [![Docker](https://github.com/geopython/pygeoapi/actions/workflows/containers.yml/badge.svg)](https://github.com/geopython/pygeoapi/actions/workflows/containers.yml) -[![Vulnerabilities](https://github.com/geopython/pygeoapi/actions/workflows/vulnerabilities.yml/badge.svg)](https://github.com/geopython/pygeoapi/actions/workflows/vulnerabilities.yml) +[![Vulnerabilities](https://github.com/geopython/pygeoapi/actions/workflows/trivy.yml/badge.svg)](https://github.com/geopython/pygeoapi/actions/workflows/trivy.yml) [pygeoapi](https://pygeoapi.io) is a Python server implementation of the [OGC API](https://ogcapi.ogc.org) suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is [open source](https://opensource.org/) and released under an [MIT license](https://github.com/geopython/pygeoapi/blob/master/LICENSE.md). diff --git a/docs/source/development.rst b/docs/source/development.rst index 8ea86cc668..bf49a04264 100644 --- a/docs/source/development.rst +++ b/docs/source/development.rst @@ -16,7 +16,7 @@ A given GitHub Pull Request is evaluated against the following GitHub Actions: - ``main``: mainline testing harness (as defined in ``tests``) - ``flake8``: code linting - ``docs``: documentation updates (for files updated in ``docs/**.rst``) -- ``vulnerabilities``: Trivy vulnerability scanning +- ``trivy``: Trivy vulnerability scanning Testing ------- diff --git a/requirements-docker.txt b/requirements-docker.txt index 5a98fca380..38306f01f9 100644 --- a/requirements-docker.txt +++ b/requirements-docker.txt @@ -4,8 +4,8 @@ pygeofilter[backend-sqlalchemy] pygeoif pygeometa sodapy -s3fs<=2023.6.0 +s3fs Flask>=2.2.0 Flask-Cors urllib3>2 -botocore>1.42 \ No newline at end of file +botocore>1.42 diff --git a/requirements-provider.txt b/requirements-provider.txt index 92d90045a2..ad4eda4d32 100644 --- a/requirements-provider.txt +++ b/requirements-provider.txt @@ -22,6 +22,6 @@ pymongo==4.18.3 pymysql scipy sodapy -xarray +xarray<2026.9.0 zarr<3 s3fs<=2023.6.0 From 6b010f313dae1d10a0c8fbda2265287b019c6a9b Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Wed, 28 Oct 2026 13:40:51 -0400 Subject: [PATCH 2/4] unpin xarray as well as zarr --- requirements-provider.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-provider.txt b/requirements-provider.txt index ad4eda4d32..24aceea79e 100644 --- a/requirements-provider.txt +++ b/requirements-provider.txt @@ -22,6 +22,6 @@ pymongo==4.18.3 pymysql scipy sodapy -xarray<2026.9.0 -zarr<3 +xarray +zarr s3fs<=2023.6.0 From aa2999e1c6a1027d76f72d847384028ead1fe84b Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Wed, 28 Oct 2026 14:42:33 -0400 Subject: [PATCH 3/4] update deps for zarr 2/3 --- pygeoapi/provider/xarray_.py | 11 ++++++----- tests/provider/test_xarray_zarr_provider.py | 12 +++++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pygeoapi/provider/xarray_.py b/pygeoapi/provider/xarray_.py index 619e071279..08fd6ff2e1 100644 --- a/pygeoapi/provider/xarray_.py +++ b/pygeoapi/provider/xarray_.py @@ -64,12 +64,12 @@ def __init__(self, provider_def): open_options = {} squeeze = provider_def.get('options', {}).get('squeeze', False) - zarr_options = provider_def.get('options', {}).get('zarr', {}) + self.zarr_options = provider_def.get('options', {}).get('zarr', {}) try: if provider_def['data'].endswith('.zarr'): open_func = xarray.open_zarr - open_options = zarr_options + open_options = self.zarr_options else: if '*' in self.data: LOGGER.debug('Detected multi file dataset') @@ -158,7 +158,8 @@ def query(self, properties=[], subsets={}, bbox=[], bbox_crs=4326, if not properties and not subsets and format_ != 'json': LOGGER.debug('No parameters specified, returning native data') if format_ == 'zarr': - return _get_zarr_data(self._data) + zarr_format = self.zarr_options.get('zarr_format') + return _get_zarr_data(self._data, zarr_format) else: return read_data(self.data) @@ -658,7 +659,7 @@ def _zip_dir(path, ziph, cwd): os.chdir(cwd) -def _get_zarr_data(data): +def _get_zarr_data(data, zarr_format=None): """ Returns bytes to read from Zarr directory zip :param data: Xarray dataset of coverage data @@ -671,7 +672,7 @@ def _get_zarr_data(data): zarr_data_filename = f'{tmp_dir}zarr.zarr' zarr_zip_filename = f'{tmp_dir}zarr.zarr.zip' - data.to_zarr(zarr_data_filename, mode='w') + data.to_zarr(zarr_data_filename, mode='w', zarr_format=zarr_format) with zipfile.ZipFile(zarr_zip_filename, 'w', zipfile.ZIP_DEFLATED) as zipf: # noqa _zip_dir(zarr_data_filename, zipf, os.getcwd()) diff --git a/tests/provider/test_xarray_zarr_provider.py b/tests/provider/test_xarray_zarr_provider.py index 1b66f6a072..76a99c85ce 100644 --- a/tests/provider/test_xarray_zarr_provider.py +++ b/tests/provider/test_xarray_zarr_provider.py @@ -52,6 +52,11 @@ def config(): 'format': { 'name': 'zarr', 'mimetype': 'application/zip' + }, + 'options': { + 'zarr': { + 'zarr_format': 2 + } } } @@ -61,12 +66,17 @@ def config_no_time(tmp_path): ds = xr.open_zarr(path) ds = ds.sel(time=ds.time[0]) ds = ds.drop_vars('time') - ds.to_zarr(tmp_path / 'no_time.zarr') + ds.to_zarr(tmp_path / 'no_time.zarr', zarr_format=2) return { 'name': 'zarr', 'type': 'coverage', 'data': str(tmp_path / 'no_time.zarr'), 'format': {'name': 'zarr', 'mimetype': 'application/zip'}, + 'options': { + 'zarr': { + 'zarr_format': 2 + } + } } From a9d06948d886cf0831ab93b703878d0277c9e067 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Wed, 28 Oct 2026 16:25:49 -0400 Subject: [PATCH 4/4] unpin s3fs and pymongo --- requirements-provider.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-provider.txt b/requirements-provider.txt index 24aceea79e..6e64a3b578 100644 --- a/requirements-provider.txt +++ b/requirements-provider.txt @@ -18,10 +18,10 @@ pyarrow pygeofilter[backend-sqlalchemy] pygeoif pygeometa -pymongo==4.18.3 +pymongo pymysql scipy sodapy xarray zarr -s3fs<=2023.6.0 +s3fs