| 1 |
=========================================== |
| 2 |
Binary data structures (un-)Packing library |
| 3 |
=========================================== |
| 4 |
|
| 5 |
.. badges |
| 6 |
|
| 7 |
|PyPI Status| |GHA Status| |Documentation Status| |Python Versions| |License| |
| 8 |
|
| 9 |
.. |PyPI Status| image:: https://img.shields.io/pypi/v/bpack.svg |
| 10 |
:target: https://pypi.org/project/bpack |
| 11 |
:alt: PyPI Status |
| 12 |
.. |GHA Status| image:: https://github.com/avalentino/bpack/actions/workflows/ci.yml/badge.svg |
| 13 |
:target: https://github.com/avalentino/bpack/actions |
| 14 |
:alt: GitHub Actions Status |
| 15 |
.. |Documentation Status| image:: https://readthedocs.org/projects/bpack/badge/?version=latest |
| 16 |
:target: https://bpack.readthedocs.io/en/latest/?badge=latest |
| 17 |
:alt: Documentation Status |
| 18 |
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/bpack |
| 19 |
:target: https://pypi.org/project/bpack |
| 20 |
:alt: Supported Python versions |
| 21 |
.. |License| image:: https://img.shields.io/pypi/l/${packagename} |
| 22 |
:target: https://pypi.org/project/${packagename} |
| 23 |
:alt: License |
| 24 |
|
| 25 |
.. description |
| 26 |
|
| 27 |
The *bpack* Python package provides tools to describe and encode/decode |
| 28 |
binary data. |
| 29 |
|
| 30 |
Binary data are assumed to be organized in *records*, each composed by a |
| 31 |
sequence of fields. Fields are characterized by a known size, offset |
| 32 |
(w.r.t. the beginning of the record) and datatype. |
| 33 |
|
| 34 |
The package provides classes and functions that can be used to: |
| 35 |
|
| 36 |
* describe binary data structures in a declarative way (structures can |
| 37 |
be specified up to the bit level) |
| 38 |
* automatically generate encoders/decoders for a specified data descriptor |
| 39 |
|
| 40 |
Encoders/decoders (*backends*) rely on well known Python packages like: |
| 41 |
|
| 42 |
* |struct| (form the standard library) |
| 43 |
* bitstruct_ (optional) |
| 44 |
* numpy_ (optional) |
| 45 |
* bitarray_ (optional) - partial implementation |
| 46 |
|
| 47 |
|
| 48 |
.. _struct: https://docs.python.org/3/library/struct.html |
| 49 |
.. _bitstruct: https://github.com/eerimoq/bitstruct |
| 50 |
.. _numpy: https://numpy.org |
| 51 |
.. _bitarray: https://github.com/ilanschnell/bitarray |
| 52 |
|
| 53 |
.. local-definitions |
| 54 |
|
| 55 |
.. |struct| replace:: struct_ |
| 56 |
|
| 57 |
|
| 58 |
License |
| 59 |
------- |
| 60 |
|
| 61 |
:Copyright: 2020-2025, Antonio Valentino <[email protected]> |
| 62 |
|
| 63 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 64 |
you may not use this file except in compliance with the License. |
| 65 |
You may obtain a copy of the License at |
| 66 |
|
| 67 |
https://www.apache.org/licenses/LICENSE-2.0 |
| 68 |
|
| 69 |
Unless required by applicable law or agreed to in writing, software |
| 70 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 71 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 72 |
See the License for the specific language governing permissions and |
| 73 |
limitations under the License. |