This software provides a binary serialization format that is concise, effective, and capable of extension.
Extprot allows structured data messages to be defined, in a way that is similar to Google's Protocol Buffers and Apache Thrift. These messages are essentially a set of typed key-value pairs, which can be efficiently serialized and deserialized into a compact binary format. These messages are defined in a protocol file that is language-neutral.
For instance, a simple example of defining an extprot message is shown below:
message person = {
id: int;
name: string;
emails:[string]
}
Here, the 'person' message contains three fields: 'id' is an integer, 'name' is a string, and 'emails' is a list of strings. The protocol descriptions are compiled into a set of Python classes that is easy to manipulate using standard syntax and idioms.
If the above protocol is recorded in the file "person.proto", a simple example of how it can be used is shown below:
>>> extprot.import_protocol("person.proto",globals())
>>> p1 = person(1,"Guido")
>>> print p1.emails
[]
>>> p1.emails.append("[email protected]")
>>> p1.emails.append(7)
Traceback (mosts recent call last):
...
ValueError: not a valid String: 7
>>> print repr(p1.to_string())
'[email protected]'
>>> print person.from_string(p1.to_string()).name
'Guido'
Extprot is compared favorably to similar serialization technologies, because it has a powerful type system, which includes strongly-typed tuples and lists, tagged disjoint unions, and parametric polymorphism. The data is also self-delimiting, which makes it easy to stream and skip messages. The data is also self-describing, because the skeleton of a message can be reconstructed without having the protocol definition. The binary format is also compact, which allows messages to maintain backward and forward compatibility across protocol extensions. This includes adding fields to a message, adding elements to a tuple, adding cases to a disjoint union, and promoting a primitive type into a tuple, list or union.
In summary, extprot is a powerful software that is extensible and efficient in handling binary data. It is a great choice for software developers who want to develop structured data messages in a way that is compact and easy to handle.
Version 0.2.1: N/A