Skip to content

Commit 2bbfe09

Browse files
authored
Merge pull request geopython#1941 from francbartoli/feature/pydantic-v2
2 parents 8fc8ba3 + c362b32 commit 2bbfe09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+404
-402
lines changed

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# Copyright (c) 2020 Tom Kralidis
99
# Copyright (c) 2019 Just van den Broecke
10-
# Copyright (c) 2020 Francesco Bartoli
10+
# Copyright (c) 2025 Francesco Bartoli
1111
# Copyright (c) 2024 Angelos Tzotsos
1212
# Copyright (c) 2023 Bernhard Mallinger
1313
#
@@ -134,12 +134,11 @@ RUN python3 -m pip install --no-cache-dir -r requirements-docker.txt \
134134
ADD . /pygeoapi
135135

136136
# Install pygeoapi
137-
RUN python3 -m pip install --no-cache-dir -e .
137+
RUN python3 -m pip install --no-cache-dir -e .
138138

139-
RUN \
139+
RUN \
140140
# Set default config and entrypoint for Docker Image
141141
cp /pygeoapi/docker/default.config.yml /pygeoapi/local.config.yml \
142-
&& cp /pygeoapi/docker/entrypoint.sh /entrypoint.sh
142+
&& cp /pygeoapi/docker/entrypoint.sh /entrypoint.sh
143143

144144
ENTRYPOINT ["/entrypoint.sh"]
145-

docker/default.config.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# Copyright (c) 2019 Just van den Broecke
88
# Copyright (c) 2020 Tom Kralidis
9-
# Copyright (c) 2020 Francesco Bartoli
9+
# Copyright (c) 2025 Francesco Bartoli
1010
#
1111
# Permission is hereby granted, free of charge, to any person
1212
# obtaining a copy of this software and associated documentation
@@ -218,18 +218,18 @@ resources:
218218
# target_srs: EPSG:4326
219219
source_capabilities:
220220
paging: True
221-
221+
222222
source_options:
223223
# OGR_WFS_VERSION: 1.1.0
224224
OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN: NO
225-
225+
226226
gdal_ogr_options:
227227
EMPTY_AS_NULL: NO
228228
GDAL_CACHEMAX: 64
229229
# GDAL_HTTP_PROXY: (optional proxy)
230230
# GDAL_PROXY_AUTH: (optional auth for remote WFS)
231231
CPL_DEBUG: NO
232-
232+
233233
crs:
234234
- http://www.opengis.net/def/crs/EPSG/0/4258
235235
- http://www.opengis.net/def/crs/EPSG/0/28992
@@ -269,18 +269,18 @@ resources:
269269
# target_srs: EPSG:4326
270270
source_capabilities:
271271
paging: True
272-
272+
273273
source_options:
274274
# OGR_WFS_VERSION: 2.0.0
275275
OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN: NO
276-
276+
277277
gdal_ogr_options:
278278
EMPTY_AS_NULL: NO
279279
GDAL_CACHEMAX: 64
280280
# GDAL_HTTP_PROXY: (optional proxy)
281281
# GDAL_PROXY_AUTH: (optional auth for remote WFS)
282282
CPL_DEBUG: NO
283-
283+
284284
crs:
285285
- http://www.opengis.net/def/crs/EPSG/0/4258
286286
- http://www.opengis.net/def/crs/EPSG/0/26912
@@ -319,18 +319,18 @@ resources:
319319
# target_srs: EPSG:4326
320320
source_capabilities:
321321
paging: True
322-
322+
323323
source_options:
324324
# OGR_WFS_VERSION: 1.1.0
325325
OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN: NO
326-
326+
327327
gdal_ogr_options:
328328
EMPTY_AS_NULL: NO
329329
GDAL_CACHEMAX: 64
330330
# GDAL_HTTP_PROXY: (optional proxy)
331331
# GDAL_PROXY_AUTH: (optional auth for remote WFS)
332332
CPL_DEBUG: NO
333-
333+
334334
crs:
335335
- http://www.opengis.net/def/crs/EPSG/0/4258
336336
- http://www.opengis.net/def/crs/EPSG/0/32632
@@ -374,14 +374,14 @@ resources:
374374
# target_srs: EPSG:4326
375375
source_capabilities:
376376
paging: True
377-
377+
378378
gdal_ogr_options:
379379
EMPTY_AS_NULL: NO
380380
GDAL_CACHEMAX: 64
381381
# GDAL_HTTP_PROXY: (optional proxy)
382382
# GDAL_PROXY_AUTH: (optional auth for remote WFS)
383383
CPL_DEBUG: NO
384-
384+
385385
id_field: osm_id
386386
layer: poi_portugal
387387

@@ -414,14 +414,14 @@ resources:
414414
# target_srs: EPSG:4326
415415
source_capabilities:
416416
paging: True
417-
417+
418418
gdal_ogr_options:
419419
EMPTY_AS_NULL: NO
420420
GDAL_CACHEMAX: 64
421421
# GDAL_HTTP_PROXY: (optional proxy)
422422
# GDAL_PROXY_AUTH: (optional auth for remote WFS)
423423
CPL_DEBUG: NO
424-
424+
425425
id_field: id
426426
layer: ne_110m_lakes
427427

@@ -457,14 +457,14 @@ resources:
457457
# target_srs: EPSG:4326
458458
source_capabilities:
459459
paging: True
460-
460+
461461
gdal_ogr_options:
462462
EMPTY_AS_NULL: NO
463463
GDAL_CACHEMAX: 64
464464
# GDAL_HTTP_PROXY: (optional proxy)
465465
# GDAL_PROXY_AUTH: (optional auth for remote WFS)
466466
CPL_DEBUG: NO
467-
467+
468468
id_field: id
469469
layer: ogrgeojson
470470

@@ -499,14 +499,14 @@ resources:
499499
# target_srs: EPSG:4326
500500
source_capabilities:
501501
paging: True
502-
502+
503503
gdal_ogr_options:
504504
EMPTY_AS_NULL: NO
505505
GDAL_CACHEMAX: 64
506506
# GDAL_HTTP_PROXY: (optional proxy)
507507
# GDAL_PROXY_AUTH: (optional auth for remote WFS)
508508
CPL_DEBUG: NO
509-
509+
510510
id_field: id
511511
layer: OGRGeoJSON
512512

pygeoapi/api/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Ricardo Garcia Silva <ricardo.garcia.silva@geobeyond.it>
99
#
1010
# Copyright (c) 2025 Tom Kralidis
11-
# Copyright (c) 2022 Francesco Bartoli
11+
# Copyright (c) 2025 Francesco Bartoli
1212
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
1313
# Copyright (c) 2023 Ricardo Garcia Silva
1414
#
@@ -212,6 +212,7 @@ def example_method(api: API, request: APIRequest, custom_arg):
212212
:param request: The web platform specific Request instance.
213213
:param supported_locales: List or set of supported Locale instances.
214214
"""
215+
215216
def __init__(self, request, supported_locales):
216217
# Set default request data
217218
self._data = b''
@@ -336,7 +337,7 @@ def _get_format(self, headers) -> Union[str, None]:
336337

337338
# Format not specified: get from Accept headers (MIME types)
338339
# e.g. format_ = 'text/html'
339-
h = headers.get('accept', headers.get('Accept', '')).strip() # noqa
340+
h = headers.get('accept', headers.get('Accept', '')).strip() # noqa
340341
(fmts, mimes) = zip(*FORMAT_TYPES.items())
341342
# basic support for complex types (i.e. with "q=0.x")
342343
for type_ in (t.split(';')[0].strip() for t in h.split(',') if t):
@@ -1134,10 +1135,10 @@ def describe_collections(api: API, request: APIRequest,
11341135

11351136
# OAPIF Part 2 - list supported CRSs and StorageCRS
11361137
if collection_data_type in ['edr', 'feature']:
1137-
collection['crs'] = get_supported_crs_list(collection_data, DEFAULT_CRS_LIST) # noqa
1138-
collection['storageCRS'] = collection_data.get('storage_crs', DEFAULT_STORAGE_CRS) # noqa
1138+
collection['crs'] = get_supported_crs_list(collection_data, DEFAULT_CRS_LIST) # noqa
1139+
collection['storageCRS'] = collection_data.get('storage_crs', DEFAULT_STORAGE_CRS) # noqa
11391140
if 'storage_crs_coordinate_epoch' in collection_data:
1140-
collection['storageCrsCoordinateEpoch'] = collection_data.get('storage_crs_coordinate_epoch') # noqa
1141+
collection['storageCrsCoordinateEpoch'] = collection_data.get('storage_crs_coordinate_epoch') # noqa
11411142

11421143
elif collection_data_type == 'coverage':
11431144
# TODO: translate
@@ -1176,7 +1177,7 @@ def describe_collections(api: API, request: APIRequest,
11761177
collection['extent']['spatial']['grid'] = [{
11771178
'cellsCount': p._coverage_properties['width'],
11781179
'resolution': p._coverage_properties['resx']
1179-
}, {
1180+
}, {
11801181
'cellsCount': p._coverage_properties['height'],
11811182
'resolution': p._coverage_properties['resy']
11821183
}]

pygeoapi/api/coverages.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Bernhard Mallinger <bernhard.mallinger@eox.at>
1010
#
1111
# Copyright (c) 2024 Tom Kralidis
12-
# Copyright (c) 2022 Francesco Bartoli
12+
# Copyright (c) 2025 Francesco Bartoli
1313
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
1414
# Copyright (c) 2023 Ricardo Garcia Silva
1515
# Copyright (c) 2024 Bernhard Mallinger
@@ -161,8 +161,8 @@ def get_collection_coverage(
161161
except (AttributeError, ValueError) as err:
162162
msg = f'Invalid subset: {err}'
163163
return api.get_exception(
164-
HTTPStatus.BAD_REQUEST, headers, format_,
165-
'InvalidParameterValue', msg)
164+
HTTPStatus.BAD_REQUEST, headers, format_,
165+
'InvalidParameterValue', msg)
166166

167167
if not set(subsets.keys()).issubset(p.axes):
168168
msg = 'Invalid axis name'

pygeoapi/api/environmental_data_retrieval.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Bernhard Mallinger <bernhard.mallinger@eox.at>
1010
#
1111
# Copyright (c) 2024 Tom Kralidis
12-
# Copyright (c) 2022 Francesco Bartoli
12+
# Copyright (c) 2025 Francesco Bartoli
1313
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
1414
# Copyright (c) 2023 Ricardo Garcia Silva
1515
# Copyright (c) 2024 Bernhard Mallinger
@@ -148,7 +148,7 @@ def get_collection_edr_instances(api: API, request: APIRequest, dataset,
148148
'href': f'{uri}/instances/{instance}/{qt}',
149149
'rel': 'data',
150150
'title': f'{qt} query'
151-
}
151+
}
152152
}
153153
instance_dict['data_queries'][qt] = data_query
154154

@@ -166,7 +166,7 @@ def get_collection_edr_instances(api: API, request: APIRequest, dataset,
166166
'href': f'{links_uri}?f={F_JSON}',
167167
'rel': request.get_linkrel(F_JSON),
168168
'type': 'application/json'
169-
}, {
169+
}, {
170170
'href': f'{links_uri}?f={F_HTML}',
171171
'rel': request.get_linkrel(F_HTML),
172172
'type': 'text/html'

pygeoapi/api/itemtypes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Ricardo Garcia Silva <ricardo.garcia.silva@geobeyond.it>
99
#
1010
# Copyright (c) 2024 Tom Kralidis
11-
# Copyright (c) 2022 Francesco Bartoli
11+
# Copyright (c) 2025 Francesco Bartoli
1212
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
1313
# Copyright (c) 2023 Ricardo Garcia Silva
1414
#
@@ -352,7 +352,7 @@ def get_collection_items(
352352
HTTPStatus.BAD_REQUEST, headers, request.format,
353353
'NoApplicableCode', msg)
354354

355-
supported_crs_list = get_supported_crs_list(provider_def, DEFAULT_CRS_LIST) # noqa
355+
supported_crs_list = get_supported_crs_list(provider_def, DEFAULT_CRS_LIST) # noqa
356356
if bbox_crs not in supported_crs_list:
357357
msg = f'bbox-crs {bbox_crs} not supported for this collection'
358358
return api.get_exception(
@@ -367,7 +367,7 @@ def get_collection_items(
367367
if len(bbox) > 0:
368368
try:
369369
# Get a pyproj CRS instance for the Collection's Storage CRS
370-
storage_crs = provider_def.get('storage_crs', DEFAULT_STORAGE_CRS) # noqa
370+
storage_crs = provider_def.get('storage_crs', DEFAULT_STORAGE_CRS) # noqa
371371

372372
# Do the (optional) Transform to the Storage CRS
373373
bbox = transform_bbox(bbox, bbox_crs, storage_crs)
@@ -621,8 +621,8 @@ def get_collection_items(
621621
data=content,
622622
options={
623623
'provider_def': get_provider_by_type(
624-
collections[dataset]['providers'],
625-
'feature')
624+
collections[dataset]['providers'],
625+
'feature')
626626
}
627627
)
628628
except FormatterSerializationError:

pygeoapi/api/maps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Bernhard Mallinger <bernhard.mallinger@eox.at>
1010
#
1111
# Copyright (c) 2024 Tom Kralidis
12-
# Copyright (c) 2022 Francesco Bartoli
12+
# Copyright (c) 2025 Francesco Bartoli
1313
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
1414
# Copyright (c) 2023 Ricardo Garcia Silva
1515
# Copyright (c) 2024 Bernhard Mallinger

pygeoapi/api/processes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Francesco Martinelli <francesco.martinelli@ingv.it>
1111
#
1212
# Copyright (c) 2024 Tom Kralidis
13-
# Copyright (c) 2022 Francesco Bartoli
13+
# Copyright (c) 2025 Francesco Bartoli
1414
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
1515
# Copyright (c) 2023 Ricardo Garcia Silva
1616
# Copyright (c) 2024 Bernhard Mallinger
@@ -65,7 +65,7 @@
6565
LOGGER = logging.getLogger(__name__)
6666

6767
CONFORMANCE_CLASSES = [
68-
'http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/ogc-process-description', # noqa
68+
'http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/ogc-process-description', # noqa
6969
'http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/core',
7070
'http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/json',
7171
'http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/oas30',

pygeoapi/api/stac.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Bernhard Mallinger <bernhard.mallinger@eox.at>
1010
#
1111
# Copyright (c) 2024 Tom Kralidis
12-
# Copyright (c) 2022 Francesco Bartoli
12+
# Copyright (c) 2025 Francesco Bartoli
1313
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
1414
# Copyright (c) 2023 Ricardo Garcia Silva
1515
# Copyright (c) 2024 Bernhard Mallinger

pygeoapi/api/tiles.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Bernhard Mallinger <bernhard.mallinger@eox.at>
1010
#
1111
# Copyright (c) 2024 Tom Kralidis
12-
# Copyright (c) 2022 Francesco Bartoli
12+
# Copyright (c) 2025 Francesco Bartoli
1313
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
1414
# Copyright (c) 2023 Ricardo Garcia Silva
1515
# Copyright (c) 2024 Bernhard Mallinger
@@ -96,7 +96,7 @@ def get_collection_tiles(api: API, request: APIRequest,
9696
LOGGER.debug('Loading provider')
9797
try:
9898
t = get_provider_by_type(
99-
api.config['resources'][dataset]['providers'], 'tile')
99+
api.config['resources'][dataset]['providers'], 'tile')
100100
p = load_plugin('provider', t)
101101
except (KeyError, ProviderTypeError):
102102
msg = 'Invalid collection tiles'
@@ -363,14 +363,14 @@ def tilematrixsets(api: API,
363363
{
364364
"rel": "self",
365365
"type": "text/html",
366-
"title": f"The HTML representation of the {e.tileMatrixSet} tile matrix set", # noqa
367-
"href": f"{api.base_url}/TileMatrixSets/{e.tileMatrixSet}?f=html" # noqa
366+
"title": f"The HTML representation of the {e.tileMatrixSet} tile matrix set", # noqa
367+
"href": f"{api.base_url}/TileMatrixSets/{e.tileMatrixSet}?f=html" # noqa
368368
},
369369
{
370370
"rel": "self",
371371
"type": "application/json",
372-
"title": f"The JSON representation of the {e.tileMatrixSet} tile matrix set", # noqa
373-
"href": f"{api.base_url}/TileMatrixSets/{e.tileMatrixSet}?f=json" # noqa
372+
"title": f"The JSON representation of the {e.tileMatrixSet} tile matrix set", # noqa
373+
"href": f"{api.base_url}/TileMatrixSets/{e.tileMatrixSet}?f=json" # noqa
374374
}
375375
]
376376
})
@@ -505,7 +505,7 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str,
505505
'tags': [k],
506506
'operationId': f'get{k.capitalize()}.collection.{datatype}.getTile', # noqa
507507
'parameters': [
508-
{'$ref': f"{OPENAPI_YAML['oapit']}#/components/parameters/tileMatrixSetId"}, # noqa
508+
{'$ref': f"{OPENAPI_YAML['oapit']}#/components/parameters/tileMatrixSetId"}, # noqa
509509
{'$ref': f"{OPENAPI_YAML['oapit']}#/components/parameters/tileMatrix"}, # noqa
510510
{'$ref': f"{OPENAPI_YAML['oapit']}#/components/parameters/tileRow"}, # noqa
511511
{'$ref': f"{OPENAPI_YAML['oapit']}#/components/parameters/tileCol"}, # noqa

0 commit comments

Comments
 (0)