Skip to content

Pydantic v1/2 compatibility #2014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

webb-ben
Copy link
Member

Overview

This PR backports Pydantic v1 compatibility to better allow long term package management.

Related Issue / discussion

#1766
#1664
#1573

Additional information

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

@kalxas kalxas requested review from kalxas and tomkralidis May 17, 2025 13:53
@kalxas kalxas requested review from francbartoli and GeoSander May 17, 2025 13:55
@kalxas
Copy link
Member

kalxas commented May 17, 2025

Thank you @webb-ben for this contribution!
This PR unblocks usage/packaging of pydantic 1.x in some production environments.

@kalxas kalxas added the packaging Packaging label May 17, 2025
@francbartoli
Copy link
Contributor

I'd like to make you aware that

class OAPIFormat(BaseModel):
    root: SupportedFormats = SupportedFormats.YAML

will break for example

Also, how are we imaging to handle packaging in the long term and support at the same time v1 and v2 within the same Dockerfile?

@kalxas I had understood the plan, according to this was to avoid this controversial situation on master and support production deployments with the stable branch

@kalxas
Copy link
Member

kalxas commented May 19, 2025

@francbartoli yes, that was the plan but unfortunately nothing has yet been ported to the stable branch.
If we could support both pydantic versions it would be easier to release from master.
No changes are expected for Dockerfile, it would remain as is (pydantic 2.x)

Another option is keep this PR just for the stable branch.

Regarding the breakage you point to, should we add some test to be able to detect?

@GeoSander
Copy link
Contributor

Wow, I haven't checked in on the project for a while 😅
Don't know when this was introduced, but I am happy to see that Pydantic is now being used in pygeoapi! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packaging Packaging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants