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.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl (650.2 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

msgpack_chunk-0.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (646.2 kB view details)

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

msgpack_chunk-0.3.0-cp314-cp314-musllinux_1_2_x86_64.whl (628.6 kB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

msgpack_chunk-0.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (626.8 kB view details)

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

msgpack_chunk-0.3.0-cp313-cp313-musllinux_1_2_x86_64.whl (632.1 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

msgpack_chunk-0.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (630.2 kB view details)

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

msgpack_chunk-0.3.0-cp312-cp312-musllinux_1_2_x86_64.whl (756.4 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

msgpack_chunk-0.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (643.6 kB view details)

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

msgpack_chunk-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl (740.5 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

msgpack_chunk-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl (629.2 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.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f8890677f2abc802044ad01c26381fffdfb2773ac9ade4406ccae20f0dd6eb62
MD5 c0fed3b31dc02b32d96f3a6379514834
BLAKE2b-256 0381c9ec31da4113f0df69d4c505187cc0f3dcc2872e81c80783143de9602e35

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.3.0-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.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c1341e66c19ce0bc778bb2f2254fd25942f1b9c7bfaf1c0918914befc325a8e5
MD5 10217241fb78a1ca3df117372494a5c8
BLAKE2b-256 a8a8630e8030383086c4be038ff26759131219e3336dc7ed4825a79924536710

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.3.0-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.3.0-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c4acb35715c21497f0923ec1c59b0fcf5fbc151890d8121db19523d937d490e3
MD5 32b366a02c03991fad608c72fafd068d
BLAKE2b-256 3209d6a6417babfa74a08a2b68b73518a6fb80718eea354a5b7bba3a3f4f559f

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.3.0-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.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c70c017c51453cf507b8a8f1c6c9584bfce371a96d3b77b99ee94e0edfe2c22c
MD5 8646cb56c2100f8a20ba52c4c04372ca
BLAKE2b-256 fc55ee4078d58ab0f1967ce59e804bd8b90ec0eee2bd42f312f44438144eeba7

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.3.0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.3.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a8d899af2b848cd31205936c8272000aed17b68736b4d3f1c2d9a3d7890ac507
MD5 baafc6c1b92ec24fc03dc518c989e31a
BLAKE2b-256 3d34e16a2511c655dae8ccd3551aba1874a095e2a834d2ea7930ad21935f1513

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.3.0-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.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e30f32c86f3e4cb7e474932492ad13a5cf3e6049edd371129a6755dad5c7a49d
MD5 8bebb66215d37dd8d79af3b41c35239c
BLAKE2b-256 33396a52ff75770804708ef6ab47f98c499247aa8135969398b7f4579d9f6bce

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.3.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.3.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 704573a0e29fc552b8dde0a8f06a685a52426346c72aaeb8b22f9c7f3b8fb7a0
MD5 9aa234ef602c707203df57d07f138cc5
BLAKE2b-256 04212e9131222c975c93b1f1b31ba0afd412cea8a7c1e3f8c6cf4d8bc0526774

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.3.0-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.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 017a744a558bd8d663887e068ef7427b38221779339601261cc685b6bf60d042
MD5 2bb0f8323352f11b04120d220030f23b
BLAKE2b-256 7d08bd3f49e18eb0adfe1ea9cf314c532c23b27e76e1b27d0f6a6bf6b7fc5b7a

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for msgpack_chunk-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c405c91cdbb59b69d2a60a99f10600e05977542e07fe6c9066ba994357703c8b
MD5 1799f060e6e1150d90361d5a29891f33
BLAKE2b-256 1643338aaf2c08df4461b147cb3e81c831334d5825671fddb0e3987147cc3341

See more details on using hashes here.

File details

Details for the file msgpack_chunk-0.3.0-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.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 325907fa2b9031f5e008394c1459202966715327a5208a151e46e005615391c7
MD5 fd9a7bca4629a2e95714b09b084409da
BLAKE2b-256 3d38ee0be26dc62798fa31c6c7908d84a12234dfe454c4c90321dcd36af960a2

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