Thrift vs Protocol Buffers vs Avro in Python

‹ What is Docker? | Deleting a single URL from Chrome History ›

Thrift, Protocol Buffers, and Avro are modern software projects which all contain an IDL-enabled data serialization format with Python support. One might think that because they all have an IDL that they all would enforce some level of type safety even in Python, but one would be wrong:


Thrift 0.9.2 Protobuf 2.5.0 Avro 1.7.7
Has codegen (and can validate prior to serializing) Yes Yes No
Allows None in required field during constructor Yes Yes Yes (n/a)
Allows None in required field during serialize No No No
Allows string in double field during constructor Yes No Yes (n/a)
Allows string in int field during validate Yes No No
Allows string in int field during serialize Crash No No
Allows Type1 in Type2 field during constructor Yes No Yes (n/a)
Allows Type1 in Type2 field during validate Yes No No
Allows Type1 in Type2 field during serialize Yes ✗✗✗ No No

NB: Thrift 0.9.2 does not support Python 3

Subscribe to All Posts - Wesley Tanaka