You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Some TypeSystems will overlap (eg: pydantic is an extension of python; pandas types are an extension of numpy ones). When these overlap, we often just hard code references to the other TypeSystem instance in the TypeAdapter code. This is a bit "brittle" because sometimes we want to convert both the base types + extended types.
Describe the solution you'd like
Add a TypeSystem "extends" (or similarly named) field that points to other TypeSystem to inherit from. For example, pydantic_type_system = TypeSystem(key="pydantic", extends=[python_type_system]). Then, to_{artigraph,system} would first check its own TypeAdapters before falling back to the extended systems' adapters.
Then, we'll need to pass the "root" TypeSystem around into the TypeAdapters and use that instead of any hard coded references to TypeSystems; replacing those hard coded references with extends in theirTypeSystem.
Describe alternatives you've considered
The pydantic_type_system works around this / a similar issue when converting nested models by registering a _PythonBaseModelAdapteron the python_type_system - this allows us to just call python_type_system when converting from the pydantic BaseModelAdapter to handle both python natives + sub-models. Instead, we could have the pydantic_type_system extend python natively and then letself.type_system in the Pydantic TypeAdapters handle the extension.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Some
TypeSystem
s will overlap (eg:pydantic
is an extension ofpython
;pandas
types are an extension ofnumpy
ones). When these overlap, we often just hard code references to the otherTypeSystem
instance in theTypeAdapter
code. This is a bit "brittle" because sometimes we want to convert both the base types + extended types.Describe the solution you'd like
Add a
TypeSystem
"extends" (or similarly named) field that points to otherTypeSystem
to inherit from. For example,pydantic_type_system = TypeSystem(key="pydantic", extends=[python_type_system])
. Then,to_{artigraph,system}
would first check its ownTypeAdapter
s before falling back to the extended systems' adapters.Then, we'll need to pass the "root"
TypeSystem
around into theTypeAdapters
and use that instead of any hard coded references toTypeSystem
s; replacing those hard coded references withextends
in theirTypeSystem
.Describe alternatives you've considered
The
pydantic_type_system
works around this / a similar issue when converting nested models by registering a_PythonBaseModelAdapter
on thepython_type_system
- this allows us to just callpython_type_system
when converting from the pydanticBaseModelAdapter
to handle both python natives + sub-models. Instead, we could have thepydantic_type_system
extend python natively and then letself.type_system
in the PydanticTypeAdapter
s handle the extension.The text was updated successfully, but these errors were encountered: