Skip to main content

Another MessagePack library

Project description

amsgpack - Python Message Pack module

C library for python 3.10+.

Why:

  • I couldn't negotiate adding type hints to msgpack-python
  • I couldn't negotiate adding Unpacker to ormsgpack
  • There's no stream unpacking in msgspec
  • I couldn't find another MessagePack library
  • msgpack-python interfaces are messy and the library is a bit slow

Installation

pip install amsgpack

Examples

>>> from amsgpack import packb, unpackb
>>> packb({"compact": True, "schema": 0})
b'\x82\xa7compact\xc3\xa6schema\x00'
>>> unpackb(b'\x82\xa7compact\xc3\xa6schema\x00')
{'compact': True, 'schema': 0}
>>> from amsgpack import FileUnpacker
>>> from io import BytesIO
>>> for data in FileUnpacker(BytesIO(b'\x00\x01\x02')):
...     print(data)
...
0
1
2
>>> from amsgpack import Unpacker
>>> unpacker = Unpacker()
>>> unpacker.feed(b'\x82\xa7compact\xc3\xa6schema\x00')
>>> next(unpacker)
{'compact': True, 'schema': 0}

Benchmark

Benchmark Run amsgpack_benchmark.py and then chart.py to get your values

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

amsgpack-0.1.3.tar.gz (63.1 kB view details)

Uploaded Source

File details

Details for the file amsgpack-0.1.3.tar.gz.

File metadata

  • Download URL: amsgpack-0.1.3.tar.gz
  • Upload date:
  • Size: 63.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for amsgpack-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b0494820646f28c937fff2bc08b0ac07778e8a47dc63f68a32f2ae259f6dae77
MD5 8fcd95c35c02b0b596b79998fbb66c99
BLAKE2b-256 13ac7b4991928a3e76c9721d7cb6703a389dd32ad33b4c06dc9c8a2c6800c322

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