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.

Source Distribution

Shibazuke-0.1.1.zip (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Shibazuke-0.1.1-py2.6-win32.egg (19.0 kB view details)

Uploaded Egg

File details

Details for the file Shibazuke-0.1.1.zip.

File metadata

  • Download URL: Shibazuke-0.1.1.zip
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Shibazuke-0.1.1.zip
Algorithm Hash digest
SHA256 71a2c0e666d6f8b2acc3b63dcb8cff24a401c7754a92510e86005e8f74357694
MD5 845c312743ef3267a12122d40aa76eb9
BLAKE2b-256 05cc9278bd56b88d4c2d2ba24f0d892bc3ae07cae7531c4ad83bb158dbb41e22

See more details on using hashes here.

File details

Details for the file Shibazuke-0.1.1-py2.6-win32.egg.

File metadata

File hashes

Hashes for Shibazuke-0.1.1-py2.6-win32.egg
Algorithm Hash digest
SHA256 3a6d98eb8ba8a2bc989c6d0ec30cb8641182c13853bb472dfd74d7d773a5b29e
MD5 e0973608a772cbba90d711daced13e16
BLAKE2b-256 02f20b143a5ab183caf9147a0b78ad85dc64b3e16ef256e6705c6d9f9b02ee60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page