ANN: Flatten 0.1

Heiko Wundram heikowu at ceosg.de
Tue Jul 15 20:53:15 EDT 2003


Flatten is a standalone serialization module suitable for converting a
Python object to a byte-string and back, and especially well suited for
network data transferral.

Flatten was first created out of the need for a secure way to pickle
class-instances for network transmission, and has in the mean time
evolved to become quite something more complex than only this.

Flatten offers:
- Serialization of base Python types (it better should... ;))
- Serialization of circular data structures (almost perfectly, see the
  documentation for more info why there are slight quirks)
- Serialization of predefined user classes conforming to a special
  serialization protocol and having been registered with Flatten.
- Much much more, look at the source, Luke! ;)

Detailing the serialization protocol here would be far too much, but as
a little teaser, let me state that Flatten handles class instantiation
differently than most other serializers by not only giving the topmost
class a chance to serialize/unserialize and restore data, but also all
base classes of this class. This allows objects which are received from
network to be modified on the fly at each level during unserializing
(think of pickle's __getinitargs__, but called on each class in the
MRO-tree, and not having __init__ called, but another function). It also
does automatic type/data-checking on unserializing stored data.

There are several other tidbits I've always wanted a serializer to have
but never found one which did, so just look at the documentation to see
all that Flatten can do.

Flatten is stable in its current version, and has seen about three
months of active usage as a network protocol helper library, so there
shouldn't be any more bugs in it (okay, I think I've not had an attack
on it yet, but anyway I screened the code for bugs more than once).

Author:   Heiko Wundram <heiko at asta.uni-saarland.de>
Name:     Flatten
Version:  0.1
URL:      http://www.asta.uni-saarland.de/~heiko/flatten
Requires: Python 2.3 (developed on Python 2.3b2+, but with some
           modifications should also run on earlier versions)

On a personal note: I was previously hosting most of my projects on my
own personal server, but as the university is restricting private use of
its Internet connection more and more (even cutting off my internet
connection for more than three weeks), I had to move all of them tho
this host. This means that you will also find yawPyCrypto, my PyCrypto
wrapper library, there.

Heiko Wundram.






More information about the Python-list mailing list