|Python| |PyPI version| |Downloads| |Mkdocs| |status| |Travis Build
Status| |Appveyor Build status|
Bitstream
=========
A Python library to manage binary data as
`bitstreams <https://en.wikipedia.org/wiki/Bitstream>`__.
Overview
--------
Bitstream three main features:
- It is easy to use since the bitstream abstraction is simple.
- It works seamlessly at the bit and byte level.
- It supports Python, NumPy and user-defined types.
See the documentation `Overview <http://boisgera.github.io/bitstream>`__
section for more details.
Quickstart
----------
Make sure that Python 2.7 or Python 3.6 to 3.9 are installed and that
pip, NumPy and a C compiler are available, then install bitstream with
::
$ pip install bitstream
For more details, refer to `the
documentation <http://boisgera.github.io/bitstream/installation/>`__.
Examples
--------
First, the mandatory “Hello World!” example:
::
>>> from bitstream import BitStream
>>> BitStream(b"Hello World!")
010010000110010101101100011011000110111100100000010101110110111101110010011011000110010000100001
The basic API is made of three methods only:
- ``stream = BitStream()`` to create an empty stream.
- ``stream.write(data, type)`` to write data ``data`` of type ``type``.
- ``data = stream.read(type, n)`` to read ``n`` items of type ``type``.
For example:
::
>>> stream = BitStream() # <empty>
>>> stream.write(True, bool) # 1
>>> stream.write(False, bool) # 10
>>> from numpy import int8
>>> stream.write(-128, int8) # 1010000000
>>> stream.write(b"AB", bytes) # 10100000000100000101000010
>>> stream.read(bool, 2) # 100000000100000101000010
[True, False]
>>> stream.read(int8, 1) # 0100000101000010
array([-128], dtype=int8)
>>> stream.read(bytes, 2) # <empty>
b'AB'
Refer to the documentation
`Overview <http://boisgera.github.io/bitstream/>`__ section for more
elementary examples.
Contributing
------------
Refer to
`Contributing <http://boisgera.github.io/bitstream/contributing>`__ in
the documentation.
Support
-------
If you need some support with bitstream and you haven’t found a solution
to your problem `in the
documentation <http://boisgera.github.io/bitstream/>`__, please open an
issue in the `GitHub issue
tracker <https://github.com/boisgera/bitstream/issues>`__.
If you don’t feel like you problem belongs there, you can send me an
e-mail instead; please include “bitstream” in the subject. You will find
my e-mail address in my `GitHub
profile <https://github.com/boisgera>`__.
In both cases, you will need to sign into GitHub (and `join
GitHub <https://github.com/join>`__ if you don’t already have an
account).
License
-------
Bitstream is open source software released under the `MIT
license <https://github.com/boisgera/bitstream/blob/master/LICENSE.txt>`__.
Copyright (c) 2012-2021 Sébastien Boisgérault
.. |Python| image:: https://img.shields.io/pypi/pyversions/bitstream.svg
.. |PyPI version| image:: https://img.shields.io/pypi/v/bitstream.svg
:target: https://pypi.python.org/pypi/bitstream
.. |Downloads| image:: https://pepy.tech/badge/bitstream
:target: https://pepy.tech/project/bitstream
.. |Mkdocs| image:: https://img.shields.io/badge/doc-mkdocs-blue.svg
:target: http://boisgera.github.io/bitstream
.. |status| image:: http://joss.theoj.org/papers/dd351bf2ed414a623557bb51d75b2536/status.svg
:target: http://joss.theoj.org/papers/dd351bf2ed414a623557bb51d75b2536
.. |Travis Build Status| image:: https://travis-ci.org/boisgera/bitstream.svg?branch=master
:target: https://travis-ci.org/boisgera/bitstream
.. |Appveyor Build status| image:: https://ci.appveyor.com/api/projects/status/7r59rbtqam0w11fq?svg=true
:target: https://ci.appveyor.com/project/boisgera/bitstream
Raw data
{
"_id": null,
"home_page": "https://github.com/boisgera/bitstream",
"name": "bitstream",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "S\u00e9bastien Boisg\u00e9rault",
"author_email": "Sebastien.Boisgerault@mines-paristech.fr",
"download_url": "https://files.pythonhosted.org/packages/85/bc/60cc42dbc7d2ab0ff6caefd1a28c322f8c769261c48f1e67fd727c01e5fc/bitstream-3.0.1.tar.gz",
"platform": null,
"description": "|Python| |PyPI version| |Downloads| |Mkdocs| |status| |Travis Build\nStatus| |Appveyor Build status|\n\nBitstream\n=========\n\nA Python library to manage binary data as\n`bitstreams <https://en.wikipedia.org/wiki/Bitstream>`__.\n\nOverview\n--------\n\nBitstream three main features:\n\n- It is easy to use since the bitstream abstraction is simple.\n\n- It works seamlessly at the bit and byte level.\n\n- It supports Python, NumPy and user-defined types.\n\nSee the documentation `Overview <http://boisgera.github.io/bitstream>`__\nsection for more details.\n\nQuickstart\n----------\n\nMake sure that Python 2.7 or Python 3.6 to 3.9 are installed and that\npip, NumPy and a C compiler are available, then install bitstream with\n\n::\n\n $ pip install bitstream\n\nFor more details, refer to `the\ndocumentation <http://boisgera.github.io/bitstream/installation/>`__.\n\nExamples\n--------\n\nFirst, the mandatory \u201cHello World!\u201d example:\n\n::\n\n >>> from bitstream import BitStream\n >>> BitStream(b\"Hello World!\")\n 010010000110010101101100011011000110111100100000010101110110111101110010011011000110010000100001\n\nThe basic API is made of three methods only:\n\n- ``stream = BitStream()`` to create an empty stream.\n\n- ``stream.write(data, type)`` to write data ``data`` of type ``type``.\n\n- ``data = stream.read(type, n)`` to read ``n`` items of type ``type``.\n\nFor example:\n\n::\n\n >>> stream = BitStream() # <empty>\n >>> stream.write(True, bool) # 1\n >>> stream.write(False, bool) # 10\n >>> from numpy import int8\n >>> stream.write(-128, int8) # 1010000000\n >>> stream.write(b\"AB\", bytes) # 10100000000100000101000010\n >>> stream.read(bool, 2) # 100000000100000101000010\n [True, False]\n >>> stream.read(int8, 1) # 0100000101000010\n array([-128], dtype=int8)\n >>> stream.read(bytes, 2) # <empty>\n b'AB'\n\nRefer to the documentation\n`Overview <http://boisgera.github.io/bitstream/>`__ section for more\nelementary examples.\n\nContributing\n------------\n\nRefer to\n`Contributing <http://boisgera.github.io/bitstream/contributing>`__ in\nthe documentation.\n\nSupport\n-------\n\nIf you need some support with bitstream and you haven\u2019t found a solution\nto your problem `in the\ndocumentation <http://boisgera.github.io/bitstream/>`__, please open an\nissue in the `GitHub issue\ntracker <https://github.com/boisgera/bitstream/issues>`__.\n\nIf you don\u2019t feel like you problem belongs there, you can send me an\ne-mail instead; please include \u201cbitstream\u201d in the subject. You will find\nmy e-mail address in my `GitHub\nprofile <https://github.com/boisgera>`__.\n\nIn both cases, you will need to sign into GitHub (and `join\nGitHub <https://github.com/join>`__ if you don\u2019t already have an\naccount).\n\nLicense\n-------\n\nBitstream is open source software released under the `MIT\nlicense <https://github.com/boisgera/bitstream/blob/master/LICENSE.txt>`__.\n\nCopyright (c) 2012-2021 S\u00e9bastien Boisg\u00e9rault\n\n.. |Python| image:: https://img.shields.io/pypi/pyversions/bitstream.svg\n.. |PyPI version| image:: https://img.shields.io/pypi/v/bitstream.svg\n :target: https://pypi.python.org/pypi/bitstream\n.. |Downloads| image:: https://pepy.tech/badge/bitstream\n :target: https://pepy.tech/project/bitstream\n.. |Mkdocs| image:: https://img.shields.io/badge/doc-mkdocs-blue.svg\n :target: http://boisgera.github.io/bitstream\n.. |status| image:: http://joss.theoj.org/papers/dd351bf2ed414a623557bb51d75b2536/status.svg\n :target: http://joss.theoj.org/papers/dd351bf2ed414a623557bb51d75b2536\n.. |Travis Build Status| image:: https://travis-ci.org/boisgera/bitstream.svg?branch=master\n :target: https://travis-ci.org/boisgera/bitstream\n.. |Appveyor Build status| image:: https://ci.appveyor.com/api/projects/status/7r59rbtqam0w11fq?svg=true\n :target: https://ci.appveyor.com/project/boisgera/bitstream\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Binary Data for Humans",
"version": "3.0.1",
"project_urls": {
"Homepage": "https://github.com/boisgera/bitstream"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "85bc60cc42dbc7d2ab0ff6caefd1a28c322f8c769261c48f1e67fd727c01e5fc",
"md5": "52a141046300d83637f752d74f4603e9",
"sha256": "dfd7aa4f87ce339f080b1462c2d2401c6cac5f190cb97d84353070d6c55cab1d"
},
"downloads": -1,
"filename": "bitstream-3.0.1.tar.gz",
"has_sig": false,
"md5_digest": "52a141046300d83637f752d74f4603e9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 210295,
"upload_time": "2023-09-05T16:30:48",
"upload_time_iso_8601": "2023-09-05T16:30:48.279014Z",
"url": "https://files.pythonhosted.org/packages/85/bc/60cc42dbc7d2ab0ff6caefd1a28c322f8c769261c48f1e67fd727c01e5fc/bitstream-3.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-05 16:30:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "boisgera",
"github_project": "bitstream",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"appveyor": true,
"lcname": "bitstream"
}