| 1 |
Overview |
| 2 |
======== |
| 3 |
|
| 4 |
What is bpack? |
| 5 |
-------------- |
| 6 |
|
| 7 |
.. include:: ../README.rst |
| 8 |
:start-after: .. description |
| 9 |
:end-before: .. local-definitions |
| 10 |
|
| 11 |
.. |struct| replace:: :mod:`struct` |
| 12 |
|
| 13 |
|
| 14 |
Features |
| 15 |
-------- |
| 16 |
|
| 17 |
* declarative description of binary data structures |
| 18 |
* specification of data structures up to *bit* level |
| 19 |
* automatic *codec* generation from data descriptors |
| 20 |
* decoding (from binary data to Python objects) |
| 21 |
* encoding (from Python objects to binary data) |
| 22 |
* backend: |
| 23 |
|
| 24 |
- :mod:`bpack.st` backend based on the :mod:`struct` module of |
| 25 |
standard Python_ library |
| 26 |
- :mod:`bpack.bs` backend based on bitstruct_ |
| 27 |
- :mod:`bpack.np` backend based on numpy_ |
| 28 |
- :mod:`bpack.ba` backend based on bitarray_ |
| 29 |
(only included for benchmarking purposes) |
| 30 |
|
| 31 |
* support for signed/unsigned integer types |
| 32 |
* support for :class:`enum.Enum` types |
| 33 |
* support for sequence types, i.e. fields with multiple (homogeneous) items |
| 34 |
* both bit and byte order can be specified by the user |
| 35 |
* automatic size determination for some data types |
| 36 |
* record nesting (the field in a record descriptor can be another record) |
| 37 |
* possibility to specify data types using the special type annotation class |
| 38 |
:class:`bpack.typing.T` that accepts annotations and string specifiers |
| 39 |
compatible with the numpy_ "Array Interface" and ``dtype`` |
| 40 |
* comprehensive test suite |
| 41 |
|
| 42 |
|
| 43 |
Limitations |
| 44 |
----------- |
| 45 |
|
| 46 |
* only fixed size binary records are supported by design, the size of the |
| 47 |
record shall be known at the moment of the record descriptor definition. |
| 48 |
It should be easy for the user to leverage tools provided by the *bpack* |
| 49 |
Python package to support more complex decoding scenarios. |
| 50 |
* currently it is assumed that all fields in a binary record share the |
| 51 |
same bit/byte order. The management of different byte order in the same |
| 52 |
binary record is, in principle, possible but not planned at the moment. |
| 53 |
* sequence types can only contain basic numeric types; nested sequences, |
| 54 |
sequences of enums or sequences of records are not allowed at the moment. |
| 55 |
* record nesting is only possible for records having the same base-units, |
| 56 |
bits or bytes, and compatible decoder types eventually. |
| 57 |
* currently the :mod:`bpack.np` has a limited (incomplete) support to record |
| 58 |
nesting and encoding capabilities. |
| 59 |
|
| 60 |
|
| 61 |
Possible additional features still not implemented |
| 62 |
-------------------------------------------------- |
| 63 |
|
| 64 |
* user defined converters |
| 65 |
* support for complex and datetime data types |
| 66 |
* conversion to CSV, HDF5 and :func:`numpy.dtype` |
| 67 |
|
| 68 |
|
| 69 |
.. _Python: https://www.python.org |
| 70 |
.. _bitstruct: https://github.com/eerimoq/bitstruct |
| 71 |
.. _numpy: https://numpy.org |
| 72 |
.. _bitarray: https://github.com/ilanschnell/bitarray |