Skip to main content

Fast object serializer for Python

Project description

shibazuzke provides simple and fast object serialization. Usually shibazuzke generates smaller data than picke or JSON, and faster on both serialization and de-serialization. shibazuke is intended to be safely used for interprocess-communications, so hopefully de-serializing maliciously crafted data doesn’t harm.

Usage

dumps(obj)

Return the shibazuke representation of the object as a string.

loads(string)

Read a shibazuke object hierarchy from a string.

Exapmle

Here’s simple example of shibazuzke:

>>> import shibazuke
>>> data = ['abc', {1:(2,3,4)}]
>>> result = shibazuke.dumps(data)
>>> data == shibazuke.loads(result)
True

Limitations

  • Following type of Python objects could be serialized.

    int, long, str, unicode, tuple, list, dict

  • Number of objects to be serialized is limited to 2147483647.

  • Length of serialized string is limited to 2147483647.

  • Max depth of object graphs is limited to 100, and circular reference is not supported.

    >>> import shibazuke
    >>> list1 = []
    >>> list2 = [list1]
    >>> list1.append(list2)
    >>> shibazuke.dumps(list1)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "shibazuke.pyx", line 524, in shibazuke.dumps
      File "shibazuke.pyx", line 309, in shibazuke.Serializer.dumps
      File "shibazuke.pyx", line 300, in shibazuke.Serializer._build
      File "shibazuke.pyx", line 246, in shibazuke.Serializer._handle_list
      File "shibazuke.pyx", line 300, in shibazuke.Serializer._build
      File "shibazuke.pyx", line 246, in shibazuke.Serializer._handle_list
      File "shibazuke.pyx", line 300, in shibazuke.Serializer._build
      File "shibazuke.pyx", line 238, in shibazuke.Serializer._handle_list
    ValueError: Circular refecence([[[...]]])
    
  • Objectes can occur multiple times in the object tree to be serialized, but they are de-serialized as differect objects.

    >>> import shibazuke
    >>> list1 = []
    >>> list2 = [list1, list1]
    >>> result = shibazuke.dumps(list2)
    >>> serialized = shibazuke.loads(result)
    >>> serialized[0] is serialized[1]
    False
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Shibazuke, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size Shibazuke-0.1.1-py2.6-win32.egg (19.0 kB) File type Egg Python version 2.6 Upload date Hashes View hashes
Filename, size Shibazuke-0.1.1.zip (35.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page