skip to navigation
skip to content

destruct 0.1.0

Tiny library to parse binary structures into Python objects

Destruct is a tiny library to declaratively define data structures and parse them to Python objects.

The library is not mature by any means. Things may break, and API may significantly change in future.


Data structures are declared in a manner somehow similar to Django models:

from destruct import StructBase
import destruct.fields as f

class MyStruct(StructBase):
    timestamp = f.TimestampField()
    value = f.U32Field()

Then, parsing is just creating object:

data = MyStruct(b"\0\0\0\0\0\0\0\xFF")
assert data.timestamp == datetime.datetime.utcfromtimestamp(0)
assert data.value == 255
File Type Py Version Uploaded on Size
destruct-0.1.0.tar.gz (md5, pgp) Source 2012-08-09 4KB
  • Downloads (All Versions):
  • 0 downloads in the last day
  • 0 downloads in the last week
  • 49 downloads in the last month