construct-classes
Parse your binary structs into dataclasses
Decision gist · record as of 2026-08-14
Yes, if you need to work with binary data formats and want the safety of typed dataclasses. The package is actively maintained, has no security vulnerabilities, and low install friction. The main trade-off is that you must manually keep Construct expressions and dataclass fields in sync—this is acceptable for small to medium projects but could become error-prone at scale without additional tooling like construct-typing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Programmer must manually write matching Construct expressions and dataclass fields—no automatic type verification.
- Low friction: pure Python wheel with a single runtime dependency (construct).
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions—suitable for most projects.
last release 2026-03-31 (136 days) · last repo commit 2026-03-31 · 6 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 158,535 downloads/mo, #10,720 on PyPI
Alternatives
Verify before relying
pip install construct-classes
import construct as c
from construct_classes import Struct
class BasicStruct(Struct):
x: int
y: int
SUBCON = c.Struct(
"x" / c.Int32ul,
"y" / c.Int32ul,
)
data = b"\x01\x00\x00\x00\x02\x00\x00\x00"
parsed = BasicStruct.parse(data)
built = BasicStruct(x=100, y=200).build()- Whether construct-typing provides the full type-checking experience mentioned in the description and how it integrates with construct-classes
- Performance characteristics when parsing or packing large or deeply nested binary structures
What it is and what it does
construct-classes bridges the gap between the construct library and Python dataclasses, letting you define binary data formats as typed dataclass structs. You write a Construct expression in a SUBCON class attribute, and the package handles parsing binary input into dataclass instances and building dataclass instances back into binary output. The dataclass fields must match the Construct struct field names, and you are responsible for keeping them in sync—there is no automatic type verification.
The package supports nested structs and lists through explicit type hints and a subcon() helper, and it integrates with the dataclass decorator system, allowing you to use standard dataclass parameters like frozen=True or kw_only. It typechecks cleanly with mypy and pyright, making it suitable for projects that want strong typing around binary protocols.
Use it for
- Parse network protocol packets or binary file formats into typed dataclass objects for type-safe processing
- Serialize application dataclasses into binary format for storage or transmission over binary protocols
- Define binary struct schemas as Python classes with IDE autocompletion and static type checking
- Build binary protocol handlers where construct expressions define the wire format and dataclasses define the in-memory representation
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to work with binary data formats and want the safety of typed dataclasses.
The package is actively maintained, has no security vulnerabilities, and low install friction. The main trade-off is that you must manually keep Construct expressions and dataclass fields in sync—this is acceptable for small to medium projects but could become error-prone at scale without additional tooling like construct-typing.
Install
construct-classes on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (construct). Actively maintained with recent commits and no known vulnerabilities.
Requires Python 3.10 or later. Programmer must manually write matching Construct expressions and dataclass fields—no automatic type verification.
License in practice
MIT license permits commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install construct-classes
import construct as c
from construct_classes import Struct
class BasicStruct(Struct):
x: int
y: int
SUBCON = c.Struct(
"x" / c.Int32ul,
"y" / c.Int32ul,
)
data = b"\x01\x00\x00\x00\x02\x00\x00\x00"
parsed = BasicStruct.parse(data)
built = BasicStruct(x=100, y=200).build()
Verify before relying
- Whether construct-typing provides the full type-checking experience mentioned in the description and how it integrates with construct-classes
- Performance characteristics when parsing or packing large or deeply nested binary structures
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageconstruct |
| Maintenance | Actively maintained 136 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 158,535 / month, #10,720 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14 |
Evidence: construct_classes-0.2.3-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “binary data parsing dataclass”
- construct-classesParses binary data into Python dataclasses and packs dataclasses back…
- construct-typingAdds type hints and static type checking support to the construct…
- ormsgpackormsgpack is a fast MessagePack serialization library for Python that…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also construct-typing · flexparser · pymp4 · construct · pycstruct · kaitaistruct · dissect.cstruct · bitstruct · databind · plum-py