Skip to main content

MessagePack serializer for chunked data

Project description

Chunked implementation of MessagePack for python.

Description

The library is designed to efficiently pack and unpack large amounts of binary data for data transfer.

This is achieved with an iterative API, which allow to reuse the memory (reducing the memory footprint), and features zero-copy operations (speeding up the transformation).

Benchmark

The main use case is to transfer big binary data together with some metadata. Here is benchmark with few different setups, including the officiel msgpack library as reference.

Here is a log/log diagrams which show GB/s related to the amount of data to process.

Pack

Byterate related to the size of the packed binary

Unpack

Byterate related to the binary size to unpack

Example

Pack

import msgpack_chunk
packer = msgpack_chunk.Packer(
    expose_object_buffer="full",
)

io = ...

packer.pack(python_object)
main_buffer = bytearray(64 * 1024)
while result_buffer := packer.read_into(main_buffer):
    io.write(result_buffer)

Unpack

import msgpack_chunk
unpacker = msgpack_chunk.Unpacker()

io = ...

main_buffer = bytearray(64 * 1024)
while True:
    nb = io.readinto(main_buffer)
    if nb == 0:
        break
    unpacker.feed(main_buffer[:nb])

python_objects = list(unpacker)

Advanced unpack

Allow to write directly inside the final python object, when dealing with big binary or ext type data.

import msgpack_chunk
unpacker = msgpack_chunk.Unpacker(
    bin="bytearray",
    expose_direct_buffer=True,
)

io = ...

main_buffer = bytearray(64 * 1024)
while True:
    direct_buffer = unpacker.get_buffer()
    if direct_buffer is not None and len(direct_buffer) > 16 * 1024:
        nb = io.readinto(direct_buffer)
        if not data:
            break
        unpacker.buffer_updated(nb)
    else:
        nb = io.readinto(main_buffer)
        if nb == 0:
            break
        unpacker.feed(main_buffer[:nb])

python_objects = list(unpacker)

Resources

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

msgpack_chunk-0.2.0.dev0-cp314-cp314t-musllinux_1_2_x86_64.whl (645.2 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

msgpack_chunk-0.2.0.dev0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (641.8 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

msgpack_chunk-0.2.0.dev0-cp314-cp314-musllinux_1_2_x86_64.whl (623.9 kB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

msgpack_chunk-0.2.0.dev0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (623.3 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

msgpack_chunk-0.2.0.dev0-cp313-cp313-musllinux_1_2_x86_64.whl (626.7 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

msgpack_chunk-0.2.0.dev0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (627.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

msgpack_chunk-0.2.0.dev0-cp312-cp312-musllinux_1_2_x86_64.whl (752.8 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

msgpack_chunk-0.2.0.dev0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (639.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

msgpack_chunk-0.2.0.dev0-cp311-cp311-musllinux_1_2_x86_64.whl (738.0 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

msgpack_chunk-0.2.0.dev0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (625.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.34+ x86-64

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e2e0cd47ccd063ba00ffc6201076092600e73977b20d70426cd10e43c35418ba
MD5 147d28479192574b3bbde3691bfa26a6
BLAKE2b-256 f8b97d9f4f7759a0013c319c9070e9f5c414acbd05f777dbb4775e701f1e9334

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 fc1f48502714b09e5c76792d18257a4685c5e095750b56084eaf1462a53f7789
MD5 3696cd66bb6ea7f8b8aa2fa7f385e867
BLAKE2b-256 5707a035a8e181573029587d17b9b1d1a50d23cb524712abe12903c45c13e897

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 77752f621580767c2814b2bce6a1919eecbed03fab2651389177273bbcb7934d
MD5 f88bc08455167af3267d0ff722d8f43f
BLAKE2b-256 fa97ea433c8c4d1189bef8c747975b35ffac405c24c8fccec11b92dcf786c1ad

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 efaf8a17c60675ffa7002aa592baeb5293cb4762082c1deb5915a905b99d5e8d
MD5 20f962d16fe3fbba730672c6aadf84a5
BLAKE2b-256 6374537cd5a249d017a64a4cb160d41ebd0d6bed5f9541cd70acf9e294200055

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 383300962124b8e2385dceccddd1816c60de7fae492494a6278f0ca1cc84e332
MD5 ac03792c6c3d099d51ab243c8a5d92a5
BLAKE2b-256 ba254d01e72088131b742b77572d3d3dfb636392913cbaeddb9314553497818c

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4864d8b5d134143ea314b821f7337890111cecb536f5537ee0a743b838a6fe32
MD5 ae7377d7b134d42eefa7ba2a3babac98
BLAKE2b-256 d9ad2f66d65b0c75a5c2d046d382ba30f6fec885e00b53356a7ec74fb75278e3

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4f47364a95aa171c90f9dbafc445955c788929ab9f7f4dc3ae53ad6da85bbaf9
MD5 58d0d441fed67b39936a79354f615b31
BLAKE2b-256 af101278355a770f64166ebde9b35ec5ef2b67a579842f7a33450c236e86c189

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 fe238708e93655c684076b5353b8acde5f999dc78e3fb2b775135bcd94f9e962
MD5 8cb5275208061c7b5a1f2ddab80d76f7
BLAKE2b-256 3d338e25b41431cf38c755d4a6c6f90eabef1788d5701f4ea46d04fb3923d6b0

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b79301286b3eb70494c9d9de98b32e60964a2dca6a48df16f58e23022ff89bec
MD5 104d137fb04638a20bcbfeddb39db8b4
BLAKE2b-256 cbf40ab5ff38eb6fab5c0d4593ab3fc90c70778218caf2ff89222b95943daf24

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.2.0.dev0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.2.0.dev0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5e0628c240ca462710d1414b9e8ec0a1f89eb630e706b670c862ceea337b190f
MD5 2e0b9a9c07cac296e55abe3536198605
BLAKE2b-256 be805d6671087cb125c177c008b87387d27ef090d16269b2fddb9e070dbb7628

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