Bytemaker documentation

Version: 0.9.2

Useful links: Source Repository | Issue Tracker

What is it?

bytemaker is a Python 3.8-compatible library for byte serialization/deserialization. It brings C bitfield functionality over to Python version 3.8+. To that end, it provides methods and types for converting @dataclass-decorated classes.

What can you do with it?

bytemaker gives you the following:

  • A BitVector class analogous to Python’s bytes and bytearray classes, but for sub-byte bit quantities. BitVector readily supports conversion between bit representations and various C customizable data types.

  • A set of bittypes classes, including various-sized buffers, unsigned/signed ints, floats, and strings, that have underlying BitVector representations.

  • Support for serializing/deserializing @dataclass-decorated classes, where the annotations can be bittypess, standard-library CTypes (c_uint8, ctypes.STRUCTURE, etc.), or Python-default PyTypes (int, bool, str (char), float). Nested types? No problem!

  • Automagic support for handling any of the aforementioned objects via bytemaker.conversions.aggregate_types.to_bits_aggregate() and bytemaker.aggregate_types.from_bits_aggregate().

Quickstart guide

Use the quickstart guide to familiarize yourself with the basics of bytemaker.

To the quickstart guide

_images/book-open-solid.svg

API reference

For more in-depth details of the library, refer to the API reference.

To the API reference