Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

polywrap-msgpack

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polywrap-msgpack

WRAP msgpack encoder/decoder

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
2

Polywrap Msgpack

polywrap-msgpack adds ability to encode/decode to/from msgpack format.

It provides msgpack_encode and msgpack_decode functions which allows user to encode and decode to/from msgpack bytes

It also defines the default Extension types and extension hook for custom extension types defined by WRAP standard

Quickstart

Encoding-Decoding Native types and objects


>>> from polywrap_msgpack import msgpack_decode, msgpack_encode
>>> dictionary = {
...     "foo": 5,
...     "bar": [True, False],
...     "baz": {
...         "prop": "value"
...     }
... }
>>> encoded = msgpack_encode(dictionary)
>>> decoded = msgpack_decode(encoded)
>>> assert dictionary == decoded
>>> print(decoded)
{'foo': 5, 'bar': [True, False], 'baz': {'prop': 'value'}}
    
Encoding-Decoding Extension types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>>> from polywrap_msgpack import msgpack_decode, msgpack_encode, GenericMap
>>> counter: GenericMap[str, int] = GenericMap({
...     "a": 3,
...     "b": 2,
...     "c": 5
... })
>>> encoded = msgpack_encode(counter)
>>> decoded = msgpack_decode(encoded)
>>> assert counter == decoded
>>> print(decoded)
GenericMap({'a': 3, 'b': 2, 'c': 5})

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc