Registry / serialization / construct-classes

construct-classes

JSON →
library0.2.3pypypi✓ verified 84d ago

Parse binary structs defined with the `construct` library into Python dataclasses. Version 0.2.3 requires Python >=3.10, <4.0. Active development.

pip install construct-classes
INSTALL
IMPORT
SIG · CONSTRUCT-CLASSES
C
construct-classes
serializationpythonv0.2.3
Install
1.6s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

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

Self
from construct_classes import Self
Struct
from construct_classes import Struct
dataclass_transform
from construct_classes import dataclass_transform
from construct_classes import construct_dataclass

Define a dataclass with construct fields and parse binary data.

from construct import Struct, Int32ul, Hex, Int8ul from construct_classes import construct_dataclass @construct_dataclass class MyStruct: x: int = Int32ul y: int = Hex(Int8ul) # Parse binary data data = b'\x01\x00\x00\x00\x02' obj = MyStruct.parse(data) print(obj.x, obj.y)
Debug
Known issues
gotchaField order matters: fields must be declared in the same order as in the binary struct. The dataclass field order defines the parse order.
fix
Ensure fields are in correct order, e.g., if struct has [Int32ul, Int8ul], declare x first then y.
affects: all
gotchaSubcon fields: when using subconstructs (e.g., Hex, BytesInteger), you must wrap them correctly. Hex(Int8ul) works, but wrong usage causes cryptic errors.
fix
Use construct subcon syntax: field: type = Subcon(InnerSubcon()). For Hex, use Hex(Int8ul).
affects: all
Upgrade
Version history
0.2.3latest on PyPI · released Mar 31, 2026
Audit
Dependencies
constructrequiredconstruct-classes builds on construct for binary parsing
Agent activity
6 hits · last 30 days
node
6
Resources
construct-classes — pip install construct-classes · libregistry