bitarray
efficient arrays of booleans -- C extension
Install
bitarray on PyPI
pip
pip install bitarrayuv
uv add bitarraypoetry
poetry add bitarrayPackage facts
| License | PSF-2.0 (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 6 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: bitarray-3.10.1-cp310-cp310-macosx_10_9_x86_64.whl; bitarray-3.10.1-cp310-cp310-macosx_11_0_arm64.whl; bitarray-3.10.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; bitarray-3.10.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl; bitarray-3.10.1-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl; bitarray-3.10.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; bitarray-3.10.1-cp310-cp310-musllinux_1_2_aarch64.whl; bitarray-3.10.1-cp310-cp310-musllinux_1_2_ppc64le.whl; bitarray-3.10.1-cp310-cp310-musllinux_1_2_s390x.whl; bitarray-3.10.1-cp310-cp310-musllinux_1_2_x86_64.whl; bitarray-3.10.1-cp310-cp310-win32.whl; bitarray-3.10.1-cp310-cp310-win_amd64.whl; bitarray-3.10.1-cp310-cp310-win_arm64.whl; bitarray-3.10.1-cp311-cp311-macosx_10_9_x86_64.whl; bitarray-3.10.1-cp311-cp311-macosx_11_0_arm64.whl; bitarray-3.10.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; bitarray-3.10.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl; bitarray-3.10.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl; bitarray-3.10.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; bitarray-3.10.1-cp311-cp311-musllinux_1_2_aarch64.whl
About bitarray
from the package's own PyPI description — quoted content, verbatim
bitarray: efficient arrays of booleans
This library provides an object type which efficiently represents an array of booleans. Bitarrays are sequence types and behave very much like usual lists. Eight bits are represented by one byte in a contiguous block of memory. The user can select between two representations: little-endian and big-endian. All functionality is implemented in C. Methods for accessing the machine representation are provided, including the ability to import and export buffers. This allows creating bitarrays that are mapped to other objects, including memory-mapped files.
Key features
- The bit-endianness can be specified for each bitarray object, see below.
- Sequence methods: slicing (including slice assignment and deletion),
operations
+,*,+=,*=, theinoperator,len() - Bitwise operations:
~,&,|,^,<<,>>(as well as their in-place versions&=,|=,^=,<<=,>>=). - Free-threading support (for GIL disabled CPython 3.14 and later)
- Fast methods for encoding and decoding variable bit length prefix codes.
- Bitarray objects...
Read as markdown · JSON record · Source repository · Homepage
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
bitarray provides an efficient, memory-compact array type for storing sequences of boolean values, with support for bitwise operations, slicing, and buffer protocol access—all implemented in C for performance.
Medium install friction due to compiled C extension; however, pre-built wheels cover all major platforms (x86_64, ARM, s390x, ppc64le) and Python versions 3.7–3.14, so installation typically succeeds without compilation. Active maintenance (6 days since last release) and 792 repository stars indicate solid upkeep.
Licensed under PSF-2.0, a permissive license compatible with both commercial and open-source use with minimal restrictions.
Usage
pip install bitarray
from bitarray import bitarray
a = bitarray()
a.append(1)
a.extend([1, 0])
print(a.count(1))
Requires Python 3.7 or later; C extension compilation may be needed on platforms without pre-built wheels.
Verdict: bitarray is a mature, actively maintained library (first released 2008-08-17, latest release 2026-08-07) with zero known vulnerabilities and broad platform coverage. Its C implementation and permissive PSF-2.0 license make it a reliable choice for performance-critical boolean array operations. Install friction is moderate but manageable given comprehensive wheel availability.
Needs verification
- Whether the free-threading support (GIL-disabled CPython 3.14+) mentioned in classifiers is production-ready or experimental.
- Performance characteristics and typical use cases where bitarray outperforms alternative approaches.
Similar packages
permissive · top 1,000 on PyPI
smmappermissive · top 1,000 on PyPI
natsortpermissive · top 1,000 on PyPI
snowballstemmerpermissive · top 1,000 on PyPI
python-slugifypermissive · top 1,000 on PyPI
coloramapermissive · top 100 on PyPI
grpcio-statuspermissive · top 100 on PyPI
sentencepiecepermissive · top 1,000 on PyPI
mmh3permissive · top 1,000 on PyPI
ml-dtypespermissive · top 1,000 on PyPI