Protocyt

Compiles protobuf files into python extension modules using cython

PyPi distribution page
GitHub main page

Author/Maintainer

Eugene Chernyshov

E-mail/Jabber: Chernyshov.Eugene@gmail.com
ICQ: 165044315

Contributors

Paul Colomiets

E-mail: pc@gafol.net
Jabber: pc@jabber.gafol.net

About

Protocyt allows you to use fast serialization/deserialization functionality for your classes. Using protobuf format desription files it creates python extension modules (*.pyd or *.so) with class for each message in description. You can directly use this classes on derive your classes from them.

Protobuf is the best instrument when you need to store and load objects with fixed internal structure as fast as possible. Usually when you need to implement complicated network protocol or to store custom objects into database.

You can change your protocol definition and generated modules will safely skip obsolete fields. So you can store data in wide representation and read it in different views. If data is not consistent or not much declared protocol, loading will cause DecodeError. This DecodeError will contains description of problem and number of byte in input stream when decoding fails.

Note Protocyt is much faster than native protobuf bindings since it's using a few amount of python code. But some features (like merging several data packets into a single object) are not inplemented.

Features

  • speed
  • safety
  • small data size

Dependencies

  • jinja2 >= 2.5 to generate cython input file
  • cython >= 0.13 to compile extension modules
  • argparse to make command line arguments beautiful

Benchmark

You can check comparison to pickle charts to evaluate advantage in speed and data size.