Introducing Kim: A Python serialization and marshaling framework
Kim’s story begins some 4 years ago with two frustrated Python developers developing REST APIs in Flask. Jack and I were becoming increasingly fed up with the current toolset available, specifically the handling of data into and out of the APIs. We began discussing the idea of a library that managed both serialization and marshaling in equal measure, had a focus on security, a flexible system for extending functionality beyond the “typical” use case and above all else, something that enabled us to build the APIs we wanted to build.
Suffice to say our first attempt failed on almost every point. We managed to convince a poor unsuspecting friend (sorry Chris) that Kim was going to solve all his worldly problems and the lack of documentation was nothing to worry about. Turns out it did solve a few of his problems but it fell far short of our original aspirations, not to mention Chris’.
The main issue with the original implementation was that we had built out the features along side the development of Vizibl’s initial API. We started at OSL not long after we had began working on Kim and the requirements we had from those early days working on Vizibl certainly swayed the design.
Although it offered a lot of features over existing options we agreed that if we were to ever release Kim it would need a significant re-think.
And here we are, some two years after that first version was “released”. We’re extremely happy to be releasing Kim as an open source project under the MIT Licence.
So what does Kim have to offer?
You can get an in depth look at all of Kim’s features by reading the documentation on readthedocs.io but here is a snapshot of what Kim has to offer.
Framework agnostic. Kim works with any framework in any environment. As long as you’ve got Python you can use Kim!
Highly customisable field processing system. The pipeline system allows fields in Kim to handle the most complex of serialization and marshaling requirements. Anything is possible.
Polymorphism. Kim has support for marshaling and serializing polymorphic types giving you a huge amount of flexibility over complex data requirements.
Role System. Kim ships with a roles system which allows you to control what fields are included when marshaling and serializing. This gives you greater control of the security of your data.
Nested Marshaling & Serialization. Kim offers first class support for handling nested objects with a range of security models to give you the most flexibility over how your API represents its data.
Battle tested. Kim has been in use across several services in production for well over a year now.
Kim in action
You can find the code and documentation on Github.
Get in touch!
Kim has helped us build an API capable of meeting enterprise level security requirements without sacrificing on things important to us like ease of use, simple clean code and our sanity(ish). We’ll be continuing to write more about what Kim has to offer and of course continuing to develop new features.
Whether you love Kim and want to offer a sacrifice to the gods in our name, or perhaps you hate it and want to curse us or tell us how to make it better. Don’t hesitate. We’d love to hear from you.
Thanks for reading and don’t forget to hit the ❤ button!