Skip to main content

Simple and fast Python any object serialization with use msgpack.

Project description

Introduction

Simple pure Python object encoder and decoder using msgpack (u-msgpack-python package at bottom).

It allows encode Python object with high speed and compression since we using msgpack at bottom.

It reduce code overhead to minimum and allow you focus on algorithms.

How to use it

It is very simple:

from cw_msgpack_coder.umsgpack_coder import UmsgpackCoder


class YourNestedClass:
    pass


class YourClass:
    def __init__(name, nested)
        self.name = name
        self.nested = nested


# create coder
coder = UmsgpackCoder()

# register your classes (required because of security reasons)
coder.set_default_coder_for_class(self.YourClass)
coder.set_default_coder_for_class(self.YourNestedClass)

# register old modules names (required if you renamed some modules and want load old data)
coder.set_set_old_module_name_to_current('old_name', 'current_name')

# now create some objects to test
o = YourClass('hello world!', YourNestedClass())

# encode to bytes
encoded = coder.dumps(o)

# decode bytes to objects
o2 = coder.decode(encoded)

# o == o2!

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

cw_msgpack_coder-1.1.5.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file cw_msgpack_coder-1.1.5.tar.gz.

File metadata

  • Download URL: cw_msgpack_coder-1.1.5.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for cw_msgpack_coder-1.1.5.tar.gz
Algorithm Hash digest
SHA256 8e6bd83602fb34f878468ccf5f4f69cf760c7058bde10b5e3744d01c499abdd5
MD5 a44e5d26de2c94634b5abbe657d0053b
BLAKE2b-256 d51137cd2d1089154b985cbd85f6cc43580bc88faa08b6e664ccc419e70d3c68

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