Aleph-Alpha/aleph-alpha-client

Consider using Pydantic as a dependency?

Closed this issue · 1 comments

I think from both the user as well as developer perspective, it would make sense to use Pydantic (https://docs.pydantic.dev/latest/) for the request and response models of the client. This will give users the benefit of runtime validation and more meaningful error tracebacks. For developers it will reduce the amount of boiler plate code required for example for JSON encoding and decoding.

Hi @adonath, sorry for the late response and thanks for your suggestion. I think your suggestion makes a lot of sense. If we were to re-implement our client again today, then we would probably choose Pydantic. In particular, the many from_json and to_json methods are annoying when adding new features.
But, at the moment, since we are not changing our client that frequently and are focusing our efforts on different parts of our stack, we don't want to invest the time to change our client to use Pydantic. But we will certainly keep this in mind for a future major version release. And we are of course also accepting Pull requests ;)