Skip to content

Conversation

@NeejWeej
Copy link
Collaborator

@NeejWeej NeejWeej commented Oct 1, 2025

Add extra serialization step similar to pydantic docs for circular references

https://docs.pydantic.dev/latest/concepts/forward_annotations/#cyclic-references

@NeejWeej NeejWeej force-pushed the nk/serialize_as_any_updates branch from 781d7a1 to 31bdbb6 Compare October 31, 2025 20:02
@NeejWeej NeejWeej changed the base branch from pit/serialize_as_any to main October 31, 2025 20:06
pyproject.toml Outdated
"pandas",
"pyarrow",
"pydantic>=2.6,<3",
"pydantic>=2.35,<3",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong version specifier still

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yup, I think that was the pydantic-core version where this came from.

@NeejWeej NeejWeej force-pushed the nk/serialize_as_any_updates branch from 31bdbb6 to 5367fd3 Compare October 31, 2025 20:27
@NeejWeej
Copy link
Collaborator Author

I think this is blocked by this: pydantic/pydantic#12382

Ex a build error. that occured:

E pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'ccflow.tests.test_base_serialize.MyEnum'>

Even though MyEnum has a pydantic core schema defined (it's a ccflow enum)

Notably, the above issue states:
image

That first recommendation is what we currently do with the MetaClass, and apply the SerializeAsAny annotation to pydantic BaseModels here: https://github.com/Point72/ccflow/blob/main/ccflow/base.py#L117

image

It seems we can't move off of that until these issues are addressed

@NeejWeej NeejWeej changed the title Fix tests for serialize_as_any [WIP] Utilize serialize_as_any instead of Metaclass to adjust annotations Nov 2, 2025
@NeejWeej NeejWeej added the type: feature Feature requests label Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants