Registry / serialization / plum-py

plum-py

JSON →
library0.8.7pypypi✓ verified 79d ago

Pack/Unpack Memory. A Python library for packing and unpacking binary data structures, similar to struct but with higher-level features. Current version 0.8.7, release cadence is low (last release August 2022).

pip install plum-py
INSTALL
IMPORT
SIG · PLUM-PY
P
plum-py
serializationpythonv0.8.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

boost
from plum import boost
from plum import Struct

Define a struct with fields and pack into bytes.

from plum import Struct class MyHeader(Struct): magic: 'I' # unsigned int length: 'I' data: 'I' hdr = MyHeader(magic=0x1234, length=100, data=0) buffer = hdr.pack() print(buffer.hex())
Debug
Known issues
gotchaThe import is 'from plum import Struct', not 'plum-py' or 'plum_py'. The PyPI name is plum-py but the module name is plum.
fix
Use 'from plum import Struct'.
affects: all
gotchaField types are specified as strings (e.g., 'I' for unsigned int) similar to struct module. Using Python type hints does not work; you must use struct format characters.
fix
Define fields as class-level annotations with format strings, e.g., field_name: 'I'.
affects: all
gotchaThe Struct class does not support variable-length arrays or nested structs directly. Use custom pack/unpack methods.
fix
For complex structures, consider using construct or raw struct.
affects: all
Upgrade
Version history
0.8.7latest on PyPI · released Aug 14, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
plum-py — pip install plum-py · libregistry