bitarray-hardbyte
efficient arrays of booleans -- C extension
What it is and what it does
bitarray-hardbyte is a C extension that provides a memory-efficient array type for storing boolean values. Eight bits are packed into a single byte, making it far more compact than a Python list of booleans. The library supports both big-endian and little-endian bit ordering, allowing fine-grained control over how bits map to bytes—important when working with binary protocols, file formats, or memory-mapped data.
The package behaves like a standard Python sequence: you can slice, extend, iterate, and apply bitwise operations (&, |, ^, ~, <<, >>) directly on bitarray objects. It includes utility functions for encoding/decoding variable-length prefix codes, converting to hexadecimal, creating Huffman codes, and serialization. All functionality is implemented in C for speed, and the library supports the buffer protocol for zero-copy interoperability with other binary data structures like numpy arrays.
Use it for:
- Storing large sets of boolean flags or bit masks where memory efficiency is critical.
- Implementing Bloom filters, bitmaps, or other bit-level data structures.
- Working with binary file formats or network protocols that require precise bit-level manipulation.
- Creating Huffman codes or other variable-length prefix codes for compression.
- Interfacing with memory-mapped files or C libraries that expect raw bit-level data.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides an efficient C-backed array type for storing and manipulating sequences of boolean values, with support for bitwise operations, slicing, and endianness control.
Yes, if you need memory-efficient boolean storage or bit-level operations. The package is mature, actively maintained, permissively licensed, and has no known vulnerabilities. Install friction is moderate due to C compilation, but precompiled wheels cover most common platforms. Not necessary for typical Python applications that don't require bit-level manipulation or extreme memory optimization.
Install
bitarray-hardbyte on PyPI
pip
pip install bitarray-hardbyteuv
uv add bitarray-hardbytepoetry
poetry add bitarray-hardbyteInstalling bitarray-hardbyte
Before you install
Medium install friction due to C compilation requirement, but precompiled wheels are available for common platforms (macOS, Linux, Windows, multiple architectures). Maintenance is active with recent commits and a stable release history since 2019.
License in practice
Licensed under the Python Software Foundation License (PSF), a permissive license that allows commercial and private use with minimal restrictions.
Quickstart
pip install bitarray-hardbyte
from bitarray import bitarray
a = bitarray()
a.append(1)
a.extend([1, 0])
print(a) # bitarray('110')
print(a.count(1)) # 2
Requires a C compiler if installing from source; precompiled wheels available for Python 3.6–3.10 on macOS, Linux (x86_64, i686), and Windows.
Verify before relying
- Whether bitarray-hardbyte is a maintained fork or variant of the original bitarray package and how it differs functionally.
- Current Python 3.11+ support status, given that friction evidence shows wheels only up to cp310.
Package facts
| License | PSF (permissive) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 1,628 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 93,774/month — #13,363 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bitarray_hardbyte-2.3.8-cp310-cp310-macosx_10_9_x86_64.whl; bitarray_hardbyte-2.3.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; bitarray_hardbyte-2.3.8-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; bitarray_hardbyte-2.3.8-cp310-cp310-musllinux_1_1_i686.whl; bitarray_hardbyte-2.3.8-cp310-cp310-musllinux_1_1_x86_64.whl; bitarray_hardbyte-2.3.8-cp310-cp310-win32.whl; bitarray_hardbyte-2.3.8-cp310-cp310-win_amd64.whl; bitarray_hardbyte-2.3.8-cp36-cp36m-macosx_10_9_x86_64.whl; bitarray_hardbyte-2.3.8-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; bitarray_hardbyte-2.3.8-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; bitarray_hardbyte-2.3.8-cp36-cp36m-musllinux_1_1_i686.whl; bitarray_hardbyte-2.3.8-cp36-cp36m-musllinux_1_1_x86_64.whl; bitarray_hardbyte-2.3.8-cp36-cp36m-win32.whl; bitarray_hardbyte-2.3.8-cp36-cp36m-win_amd64.whl; bitarray_hardbyte-2.3.8-cp37-cp37m-macosx_10_9_x86_64.whl; bitarray_hardbyte-2.3.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; bitarray_hardbyte-2.3.8-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; bitarray_hardbyte-2.3.8-cp37-cp37m-musllinux_1_1_i686.whl; bitarray_hardbyte-2.3.8-cp37-cp37m-musllinux_1_1_x86_64.whl; bitarray_hardbyte-2.3.8-cp37-cp37m-win32.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
bitarrayProvides an efficient C-backed array type for…
permissive · top 1,000 on PyPI
PyByteBufferPyByteBuffer provides Java ByteBuffer-style…
copyleft · top 5,000 on PyPI
tibsTibs provides immutable and mutable bit-level…
permissive · top 5,000 on PyPI
bitmapBitMap provides a compact bit array class for…
unclear · top 15,000 on PyPI
bitstringbitstring provides Python classes and functions…
permissive · top 5,000 on PyPI
graycodeConverts between two's complement integers and…
permissive · top 15,000 on PyPI
ndindexndindex provides a uniform API for representing…
permissive · top 5,000 on PyPI
leb128Encodes and decodes integers using LEB128…
permissive · top 5,000 on PyPI
fixedintProvides fixed-width integer classes that…
permissive · top 5,000 on PyPI
bitstructPacks and unpacks Python values into bit-level…
permissive · top 5,000 on PyPI