3 ms·
I also wrote a pure python validation library [0] that is much faster than pydantic. It also handles unions correctly (unlike pydantic). Pydantic2 is indeed mu
by LtWorf 4y ago
I also wrote a pure python validation library [0] that is much faster than pydantic. It also handles unions correctly (unlike pydantic).
Pydantic2 is indeed much faster than any pure python implementation I've seen, but it also introduces some bugs. And on pypy it is as slow as it ever was, because it falls back to python code.
I wrote mine because nothing else existed at the time, but whenever I've had to use pydantic I've found it to be quircky and to have strange opinions about types, that are not shared by type validators. Using it with mypy (despite the extension) is not so easy nor useful.
[0]: https://ltworf.github.io/typedload/performance.html https://ltworf.github.io/typedload/performance.html
- scolvin 4y agoIt's slow with pypy because of some problems with pyo3's interaction with pypy, not a pure python fallback. I agree unions were wrong in V1, but smart unions helped, and unions are fixed properly in V2.
- LtWorf 4y agoEh, smart unions… you're welcome for that idea that comes from my project :) Of course there was an incompatible api change there, where the smart union parameter got removed and it's impossible to obtain the old (and completely wrong) behaviour. I'm sure someone relies on that.