Tuesday, 14 September 2010

Fudge in Python

I though Fudge was an interesting format for messaging when Kirk Wylie first mentioned it last year.  Since then C and C++ libraries have appeared alongside the original Java and .Net.  Fudge, along with being a strongly-typed, extensible, self-describing format has some nice ideas, such as taxonomies that look like a good fit for some of our messaging use-cases, such as sending GLUE records over messaging.  In GLUE, keys are long and a taxomomy would help to reduce the byte count on the wire by a lot.  Also the typed nature gives us a big advantage over LDAP, and would save on lots of type conversions.

Another interesting usage (once you have a python implementation) would be automatic translation from Django Models to Fudge messages.  This could work very well with django-celery as a custom serializer.

With some time on my hands I decided to take a crack at a Python implementation of the specification.  The specification is short, and detailed enough to work from but diving into the reference implementations is highly recommended if you have any doubts on what should be done. 

A few days work has lead to a basic implementation up and running with all basic types working (except for date types).  There still is a lot missing, including recursive Fudge messages, taxonomies, context objects, streaming interfaces and better accessors for fields in a fudge Message object.  A lot of these are the next higher level functionality on top of the basic encoding/decoding functionality.

The code is now up at github, expect changes in the next few days as I flesh out the implementation.


Ngawang Froggy said...

I think you lost me in about the middle of the first para - but anyway, you have explained your messaging apps to me before so I should be able to relate better.


Kirk Wylie said...

Hi, James,

Glad to see someone doing a Python port! Is this native Python, or are you using the ANSI-C libraries for the CPython stuff?

Anything else anybody on the team can help out with?