Pydantic vs Protobuf vs Namedtuples vs Dataclasses

This page summarizes the projects mentioned and recommended in the original post on /r/Python

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • koda-validate

    Typesafe, Composable Validation

  • FYI I wrote koda-validate, which is significantly faster than pydantic, has a similar API, and is pure python.

  • pydantic-core

    Core validation logic for pydantic written in rust

  • Thanks for pointing out to that, I did not know about it. Also attaching repo in case someone would be interested as well - https://github.com/pydantic/pydantic-core

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • msgspec

    A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML

  • There's also msgspec, which per my benchmarks is: - 20-80x faster for JSON encode/decode + validate than pydantic - 5-50x faster to create/compare/order than attrs/dataclasses or pydantic.

  • typedload

    Python library to load dynamically typed data into statically typed data structures

  • I wrote typedload, which is significantly faster than pydantic. Just uses normal dataclasses/attrs/NamedTuple, has a better API and is pure Python!

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts