C-Accel-CRIPT / Python-SDK

CRIPT Python SDK
MIT License
10 stars 5 forks source link

Convert all `beartype` runtime type checker decorators to `Pydantic 2` runtime type checker decorators #185

Open nh916 opened 1 year ago

nh916 commented 1 year ago

Description

Optimistically speaking, this should be relatively painless and should involve just swapping out the decorator wrapping from beartype to Pydantic 2 then remove beartype from dependencies and add Pydantic. This should work exactly the same, but Pydantic is more popular, has more resources, and should be much easier to maintain. The types should always be standard native Python types that are universal, well documented, easy to develop with, and mypy recognizes it well as well.

However, in practice there might be debugging that is needed and additional tests to test the run time type checking for each node or most nodes.

nh916 commented 1 year ago

I think this might take a while to migrate the SDK from beartype and dataclasses to Pydantic. The best way of going about it is probably in pieces where.

First we add the type checking part of pydantic to all the nodes, which is quick decorator change.

Second we start swapping out the dataclasses for pydantic classes

Then we start tackling the serialization and deserialization.

This may need to get pushed back a bit because we have things that have higher priority, and this is more of an easier way to maintain the code. For sure needed, but the more prioritized things need to get tackled first

nh916 commented 1 year ago

the wait is over, and pydantic v2 is out

fully built out in rust which is fast, great responsive community, and very popular that will be around for a long time. The program is also well known and documented with many resources to learn more about it and debug it, making it easy for any developer to contribute to our project and making it developer friendly and standard.

See the wiki article about picking packages for the Python SDK for more reasons as to why this is a great package.