opack2

raw JSON →
0.0.1 verified Mon Apr 27 auth: no python

A Python library for parsing and serializing data in the opack format. Currently at version 0.0.1, with initial release. The library supports encoding/decoding of opack binary data.

pip install opack2
error ModuleNotFoundError: No module named 'opack2'
cause Library not installed.
fix
Run 'pip install opack2'
error ImportError: cannot import name 'pack' from 'opack'
cause Attempting to import from 'opack' instead of 'opack2'.
fix
Use 'from opack2 import pack'
error SyntaxError: invalid syntax
cause Running on Python < 3.9.
fix
Upgrade Python to 3.9+
gotcha Do not confuse opack2 with the older 'opack' package. They are separate libraries with different APIs.
fix Use 'from opack2 import pack, unpack' instead of 'from opack import ...'.
gotcha The library is in very early stage (v0.0.1). Breaking changes may occur without notice. Pin versions in production.
fix Use 'opack2==0.0.1' in requirements.txt.
deprecated No deprecations at this version.
gotcha opack2 requires Python >=3.9. It will not work on older versions.
fix Upgrade Python to 3.9 or later.

Basic usage of opack2 to pack and unpack data.

from opack2 import pack, unpack

# Pack data
data = {'key': 'value', 'number': 42}
packed = pack(data)
# Unpack data
unpacked = unpack(packed)
print(unpacked)  # {'key': 'value', 'number': 42}