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.
This PR adds support for pydantic
Old
This PR adds tests for using ZnFlow with pydantic.
The main idea would be, to use
class MyCls(BaseModel, znflow.Node)
like I do it withzninit.ZnInit
.Alternative approaches are also possible, e.g. providing a
znflow.pydantic.Node
that already provides both.The main incompatibility seems to be:
ZnFlow/znflow/node.py
Lines 117 to 132 in 3160d0b
But I can't tell for sure, if the
__getattribute__
and__setattr__
are also affected.One cause could be the usage of
metaclass
in pydantic which does not work nicely with overriding the__new__
.https://github.com/pydantic/pydantic/blob/9ab33eb82d78c55d1e66784cbd86107c1c41943d/pydantic/v1/main.py#L310