Skip to main content

destruct

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.

https://secure.travis-ci.org/drdaeman/destruct.png?branch=master

Example

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

Metadata

Release files for destruct 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for destruct 0.1.0
File Size Uploaded Provenance Actions
destruct-0.1.0.tar.gz 4.8 kB Without provenance Details for destruct-0.1.0.tar.gz

Release files / destruct-0.1.0.tar.gz

Download URL destruct-0.1.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c8f1f972e2617e5a01841876a78211d024037b050712bf7737fd670717783cae
BLAKE2b-256 checksum
How to use checksums
dd414d3c211b512b79c47cb0247c92f2c2f874005d785148a87b9052b3699300
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for destruct 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page