bitarray
efficient arrays of booleans -- C extension
Decision gist · record as of 2026-08-14
Yes. Bitarray is a mature, actively maintained library with no known vulnerabilities, permissive licensing, and wide platform support. Install it if you need memory-efficient boolean arrays or bit-level operations; the medium install friction is offset by pre-built wheels for all major platforms.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Medium install friction due to compiled C extension wheels, but pre-built wheels are available for all major platforms and Python versions from 3.7 onwards.
- Package is actively maintained with a recent release (7 days old) and has been stable since 2008.
License · maintenance · safety
PSF-2.0 (permissive) — Licensed under PSF-2.0 (permissive), allowing free use in both open-source and commercial projects with minimal restrictions.
last release 2026-08-07 (7 days) · last repo commit 2026-08-14 · 792 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 23,845,867 downloads/mo, #933 on PyPI
Alternatives
Verify before relying
pip install bitarray
from bitarray import bitarray
a = bitarray()
a.append(1)
a.extend([1, 0])
print(a)- Performance characteristics compared to alternatives for specific workloads
- Memory overhead of bitarray objects versus raw byte buffers for very large datasets
- Compatibility details with free-threading mode (GIL disabled) in CPython 3.14+
What it is and what it does
Bitarray is a C extension that provides an efficient sequence type for storing arrays of boolean values, where eight bits are packed into a single byte. It behaves like a Python list but with much lower memory overhead for boolean data. The library supports all standard sequence operations—indexing, slicing, append, extend—plus full bitwise operators (~, &, |, ^, <<, >>) and their in-place variants. You can specify bit-endianness (little or big) per object, access the raw machine representation via the buffer protocol, and work with memory-mapped files.
The package includes a utility module with helper functions for Huffman coding, hexadecimal conversion, random generation, serialization, and various counting operations. It supports pickling, type hints, and provides an immutable frozenbitarray variant for use in sets and as dictionary keys. The library has been actively maintained since 2008 and includes an extensive test suite.
Use it for
- Storing and manipulating large sets of flags or boolean states with minimal memory footprint
- Implementing Bloom filters, bit vectors, or other bitmap-based data structures
- Encoding and decoding variable-length prefix codes such as Huffman trees
- Working with binary protocols or file formats that require bit-level access and endianness control
- Compressing sparse boolean data through the utility module's compression functions
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Bitarray is a mature, actively maintained library with no known vulnerabilities, permissive licensing, and wide platform support. Install it if you need memory-efficient boolean arrays or bit-level operations; the medium install friction is offset by pre-built wheels for all major platforms.
Install
bitarray on PyPI
Before you install
Medium install friction due to compiled C extension wheels, but pre-built wheels are available for all major platforms and Python versions from 3.7 onwards. Package is actively maintained with a recent release (7 days old) and has been stable since 2008.
License in practice
Licensed under PSF-2.0 (permissive), allowing free use in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install bitarray
from bitarray import bitarray
a = bitarray()
a.append(1)
a.extend([1, 0])
print(a)
Verify before relying
- Performance characteristics compared to alternatives for specific workloads
- Memory overhead of bitarray objects versus raw byte buffers for very large datasets
- Compatibility details with free-threading mode (GIL disabled) in CPython 3.14+
Package 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 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 23,845,867 / month, #933 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 6 - MatureIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: CProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Free Threading :: 2 - BetaTopic :: Utilities |
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
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “efficient bitarray implementation”
- bitarrayProvides an efficient C-backed array type for storing and…
- bitarray-hardbyteProvides an efficient C-backed array type for storing and…
- bitstringbitstring provides Python classes and functions to create,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also bitarray-hardbyte · graycode · tibs · ndindex · bitstring · intbitset · fixedint · cbitstruct · PyByteBuffer · awkward0