4 ms·
Pydantic offers runtime checks. Also I’d add msgspec to your list at the end. Lightweight and fast, handles validation during decoding.
by intalentive 2y ago
Pydantic offers runtime checks.
Also I’d add msgspec to your list at the end. Lightweight and fast, handles validation during decoding.
- mejutoco 2y agoTypeguard too. The @typechecked annotation on any function or method will blow up with an error at runtime if types do not match
- carderne 2y agoGood point, but that's not always desirable. If you have strict type-checking and _aren't_ doing ser/de, it's likely not necessary (eg Rust doesn't do runtime checks).
- nsteel 2y agoThe situation we found where it's still useful is if your app supports extension-type functionality. The 3rd parties writing extensions would ideally be type-checking during development... but they might not bother. Runtime validation becomes useful at the interfaces.