aiohttp-demos icon indicating copy to clipboard operation
aiohttp-demos copied to clipboard

Replace trafaret with pydantic

Open Dreamsorcerer opened this issue 4 years ago • 4 comments

It would probably a good idea to replace trafaret/trafaret-config with pydantic. Trafaret seems somewhat unmaintained and doesn't have any static typing support. Pydantic is likely a better option to use here.

Dreamsorcerer avatar Aug 15 '21 13:08 Dreamsorcerer

I wouldn't mind that, however, trafaret used to be very popular among the community the demos come from. So I'd maybe ping @Arfey / @Deepwalker to see what they think. And if they don't mind/respond in like a week, then it's okay to proceed.

webknjaz avatar Aug 15 '21 14:08 webknjaz

Trafaret is maintained. If I do not accept someones PRs it means that I do not think that they are ready to be merged.

About this examples – I did not write them. And I honestly think that pydantic version will be nice addition, as it is popular in community and has wide adoption.

Deepwalker avatar Aug 16 '21 13:08 Deepwalker

Thanks. The biggest issue is the support for static typing. I like the overall design of trafaret, but without the option to define things with type annotations or have any type safety from the outputs, that basically rules it out for me. We also heavily support static typing across the aio-libs projects, so it feels a bit weird to recommend a library that can easily result in removing a large chunk of type safety from the user's code.

I'd suggest for now, that we try out pydantic in the polls demo/tutorial to see how it looks (though I intend to look at sqlalchemy first in #161).

Dreamsorcerer avatar Aug 17 '21 18:08 Dreamsorcerer