Open SarahG-579462 opened 1 month ago
Note: I had to change one of the github actions, since docker images do not allow capital letters, and the repository for our organisation is "Ouranosinc". Feel free to discard this change, if needed.
To add, it would be valuable to have pygeoapi.models.pydantic that covers the try/except in one place and have the rest of code import from pygeoapi.models.pydantic
Overview
Recently, pygeoapi's pydantic was downgraded from 2.0-compatible to pydantic < 1. This removed compatibility with two of our libraries, xscen and xclim, for climate data processing, due to intake-esm's current requirement on pydantic > 2
Because we require these in the use of our pygeoapi process plugins, this change forced us to use either very outdated versions of xscen (and thus xarray, pandas, xclim, etc.), or a very outdated version of pygeoapi.
Thankfully, a simple fix is available by the use of pydantic 2's backwards-compatible pydantic.v1 module.
It is not entirely clear to me why pydantic was downgraded, the best explanation I can see in the discussion was due to "versionitis". I was, however, able to run all tests with the latest version of pydantic installed in this fashion. The way this PR is written, if pydantic >= 2 is not available on the operating system in question, everything will continue as-is.
Related Issue / discussion
Pydantic issues:
1573
1341
1584
Additional information
Dependency policy (RFC2)
(It follows RFC2 as far as I understand, as it allows backwards compatibility with pydantic < 2)
Updates to public demo
No breaking changes shuold ensue as a result of this PR, since it is backwards compatible. I am not entirely sure how to test this demo server, help would be appreciated here.
Contributions and licensing
(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)