Get rid of pydantic and move data validation to standard dataclasses#2307
Open
francbartoli wants to merge 6 commits intogeopython:masterfrom
Open
Get rid of pydantic and move data validation to standard dataclasses#2307francbartoli wants to merge 6 commits intogeopython:masterfrom
francbartoli wants to merge 6 commits intogeopython:masterfrom
Conversation
f5eec0c to
8e4f144
Compare
Contributor
Author
|
CI failures are not related to these changes |
Member
|
Its not entirely clear to me how the introduction of PluginContext is coupled this closesly with the removal of pydantic. Furthermore I am not quite sure I understand the intended utility of it - perhaps this is a documentation question. Where / How would this be used? |
Contributor
Author
That's a very good question @webb-ben, I'm happy to document what's the intended usage downstream indeed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR aims at removing
pydanticfrom the core dependencies in favor of the standarddataclasseswhile offering the same level of data validation in the codebase. At the same time it improves the extensibility of the plugin system in order to write custom plugins for data validation withpydanticor other external validation libraries.A new
PluginContextdataclass has been added to pass dependencies in the plugin system. Downstream projects/forks can extendPluginContextvia subclassing to integrate a custom validation logic.The change has a minimal footprint on the plugin design because it guarantees backwards compatibility so existing pygeoapi instances can update with zero-risk impact.
Related Issue / discussion
Mainly discussed and agreed during the summit with the ultimate goal to get rid of
pydanticand provide downstream data validation with custom pydantic-based (or similar tools) plugins#1547
#1664
Additional information
A new RFC has been raised to voting about this design change
The plan to achieve the above goal is the following:
load_plugininplugin.pymethod with an optional context based on aPluginContextdataclassBaseProvider,BaseProcessorandBaseManagerfor backwards compatibilityAPIRulesto dataclassTileSetMetadatato dataclassMVTTilesJsonto dataclassPydanticfrom the dependenciesDependency policy (RFC2)
Updates to public demo
Contributions and licensing
(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)