NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #942 most downloaded on PyPI
efficient arrays of booleans -- C extension
Latest stable
3.12.5
Last release 2 days ago
02 Dec 2026
Release timing varies
gaps range from 9 days to 5 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
18 years old
131 releases · first in 2008
Drag across the ruler to compare, or tap a release to open it.
remove vendored pythoncapi_compat.h in favor of minimal compat.h
pythoncapi_compat.h in favor of minimal compat.h
free-threaded CPython support now considered stable
RISC-V wheelsYour coding agent can read these notes before it upgrades. Set up the MCP server →
fix unaligned buffer handling on sparc64, see #259
SPARC64, RISC-V
and NetBSD 11 (amd64) (all successful)update cibuildwheel to 4.3.1 and enable PyPy and Pyodide wheel builds
uint64 alignment on SPARC64, see #247pythoncapi_compat.hfix bitarray.util import on PyPy, see issue #257
bitarray.util import on PyPy, see issue #257
add bitfields sub-module, see Bit-field structures
bitfields sub-module, see Bit-field structures
bitarray.fill()bitarray.bitfieldsadd run-length codec: util.rl_encode() and util.rl_decode()
util.rl_encode() and util.rl_decode()
util.sc_stat()util.sum_indices() inputsadjust_slice()sysinfo() and ssqi() out of the top-level namespacemove internal tests for util._Random class into devel/test_random.py
util._Random class into devel/test_random.py
decodetree structureutil.pprint() for very narrow output widthsutil.ba2int() and util.int2ba()add bitarray/test_free_threading.py - these free-threading tests are imported when Python was compiled using --disable-gil
bitarray/test_free_threading.py - these free-threading tests are
imported when Python was compiled using --disable-gildecodetree methods .nodes() and .todict()util.huffman_code() and util.canonical_huffman() return codedicts
mapping symbols to frozenbitarraysbinode_make_tree()bitarray type between
the _bitarray and _util extension modules.decode() or decodetree() cannot
exceed 256 bitsfrozendict (added in
Python 3.15): .decode(), decodetree(), .encode(),
util.huffman_code() and util.canonical_huffman()remove all occurrences of PySlice_GetIndicesEx (deprecated since Python 3.6.1)
ssqi() to devel/test_sum_indices.pyPySlice_GetIndicesEx (deprecated since
Python 3.6.1)improving free-threading readiness, see also #251:
Free Threading :: 2 - Beta
.bytereverse() instead of raising IndexErrorssize_richcompare() in favor of Py_RETURN_RICHCOMPARE macroself is a
frozenbitarray, e.g. slicing a frozenbitarrayadd .rotate() method, rotate bitarray in-place by k positions
.rotate() method, rotate bitarray in-place by k positions
decodeiterator class, and add .skipbits() method
as well as .index data descriptor, see #252random_p() silently producing all-zero bitarrays for small n
when p=float("nan")util.random_k(),
util.gen_primes(), util.pprint() and util.int2ba()python_requires >= 3.7 to package metadataunittest's functionalityclarity/wording improvements throughout project
new_allocation() to simplify resize()fixed critial findings in C Extension Analysis Report, see #250
devel/test_capi.pyadd experimental support for free-threaded builds (GIL disabled), #234
_set_default_endian().__bytes__(), see #246enable util.random_k() for all supported Python versions, previously this functions required Python 3.9 or higher
util.random_k() for all supported Python versions,
previously this functions required Python 3.9 or higher
fix type hinting for memoryviews, see #241
digit_to_int()add util.gen_primes(), generate bitarrays in which active indices are prime numbers
util.gen_primes(), generate bitarrays in which active indices are
prime numbers
.buffer_info() to return named tuplemode argument to util.sum_indices() to sum square of
active indices_sysinfo() to include Py_DEBUGadd development files for statistical tests in devel/random/
devel/random/
util.sum_indices()util.random_k(), see #239devel/test_sum_indices.pymove development files from examples/ to devel/
util.random_k(), see #237
util.sum_indices()util.xor_indices()examples/ to devel/fix DeprecationWarning regarding u type code
util.random_p() by also using bitwise AND in final step
u type codeutil.random_p()optimize util.random_p() for n < 100
util.random_p() for n < 100
optimize util.random_p() for n < 100
add Random Bitarrays documentation
improve sparse compression testing
util.random_p()
simplify and speedup extend_unicode01()
extend_unicode01()resize_lite() - avoid unused codePyTypeObject for bitarray type object in _util.c to
be consistent with _bitarray.csc_count()extend documentation of compression of sparse bitarrays
util.sc_decode() and util.vl_decode() now raise StopIteration
instead of ValueError when unexpected end of stream is encounteredread_n(), write_n() and count_from_word()optimize delslice() when step is larger than about 5
pyproject.toml, see #233
bits2bytes() in Cdelslice() when step is larger than about 5*_span() and *_range() in C for
invert, set and countzlw())remove .endian() method in favor of data descriptor .endian
.endian() method in favor of data descriptor .endian
bytes or bytearray to set buffer directly.extend() with bytes object (although the only
valid bytes are 0x00 and 0x01)util.byteswap()util.correspond_all().reverse() for imported bufferfix off-by-one-error in check for length of count argument in util.canonical_decode()
util.canonical_decode()
util.int2ba()remove License classifier in favor of a SPDX license expression, #231
License classifier in favor of a SPDX license expression, #231
add optional group and sep arguments' to .to01(), #230 - as well as util.ba2hex() and util.ba2base()
group and sep arguments' to .to01(), #230 -
as well as util.ba2hex() and util.ba2base()
util.base2ba() and util.hex2ba()* add util.xor_indices(), #229 * add Hamming code example
util.xor_indices(), #229
updated pythoncapi_compat.h for pypy3.11 support, see #227
pythoncapi_compat.h for pypy3.11 support, see #227
__builtin_parityll() when available in util.parity()parity_64() to headerallow mask assignment to bitarrays, see #225
resize() and avoid overallocation when downsizing bufferbuild_wheels.ymlgrowth/ example to resize/ and add tests for resize()remove util.rindex(), use .index(..., right=1) instead, deprecated since 2.9
.decode() now returns iterator (equivalent to past .iterdecode()).search() now returns iterator (equivalent to past .itersearch()).iterdecode() and .itersearch()util.rindex(), use .index(..., right=1) instead,
deprecated since 2.9util.make_endian(), use bitarray(..., endian=...) instead,
deprecated since 2.9bitarray() handling unpickling,
see detailed explaination in #207 - closes #206add official Python 3.13 support
optimize initialization from strings by not constantly resizing buffer
util.hex2ba() and util.base2ba() by avoiding unnecessary
copiesutil.base2ba() and util.ba2base() for n=16 (hexadecimal)avoid buffer being unnecessarily initialized with 0s in several functions of the bitarray.util module
bitarray.util module
.count() type hint in pyi-filedeprecate support for Python 2 - Python 2.7 support will be removed in bitarray version 3.0, see roadmap
bitarray(n) for integer initializer n will always return a bitarray
of length n with all items initialized to 0, see #212.count(), #212util.ones().find() and .index(): add keyword argument right for rightmost index.itersearch(): add start and stop argument, and keyword
argument right (for descending order - starting with rightmost match)util.rindex() (will be removed in 3.0 release),
use .index(..., right=True) insteadutil.make_endian() (will be removed in 3.0 release),
use bitarray(..., endian=...) insteadspeedup unaligned copies by always using word shifts (in combination with builtin byte swap 64 when available) when bit-endianness and machine byte-or
HAVE_BUILTIN_BSWAP64 to header(uint64_t *)simplify copy_n() (remove special cases), see #d2d6fd53
copy_n() (remove special cases), see #d2d6fd53
shift_r8()ensure readonly attribute is set correctly when creating new objects, see #211
update cibuildwheel to 2.16.1 in order to provide cp312 wheels on PyPI
pytest.ini to allow running pytest with no additional arguments,
see #208util.sc_encode(): avoid writing empty blocks at end of compressed
stream, i.e. skip encoding when total population count is reacheduse reconstructor function for pickling, see #207
.reverse()allow integer sequence indexing by list of indices, see #204 (addresses #156 and #190)
.bytereverse() docstring, see issue #202remove caching hash value, fixes issue #201
fix for pypy3.9-v7.3.11, #198 (fixes #188)
register bitarray as abc.MutableSequence, see #196
bitarray as abc.MutableSequence, see #196
fix popcount64 name conflict on NetBSD, #189
python setup.py testbitcount_lookup[256] tableutil.count_n() error messagesutil module tests from being run more than once in each
call to bitarray.test() when called multiple times in the same
Python process, see #6e52e49aspeedup all count functionality by using __builtin_popcountll when available, see #187
__builtin_popcountll when
available, see #187
popcount64() to bitarray.h - we assume now that uint64_t is
always available* optimize util.sc_encode()
util.sc_encode()add util.sc_encode() and util.sc_decode() for compression of sparse bitarrays
util.sc_encode() and util.sc_decode() for
compression of sparse bitarrays
util.any_and()util.intervals()hex2ba(), base2ba(), deserialize(), vl_decode(), zeros()optimize richcompare() for opposite endianness
richcompare() for opposite endianness
add documentation on shift operators, #181
richcompare()add data descriptors: .nbytes, .padbits, .readonly
.nbytes, .padbits, .readonly
endian argument to be None when creating bitarrayscanonical_decode(), #178allow negative (byte) indices in .bytereverse()
.reverse(), see #177
.bytereverse()add calculating of canonical Huffman codes util.canonical_huffman() and decoding thereof util.canonical_decode(), see #173
util.canonical_huffman()
and decoding thereof util.canonical_decode(), see #173
util.huffman_code() and util.canonical_huffman(), see #172.frombytes() and .pack() - previously,
the arguments were limited to the bytes object, see #174util.deserialize().bytereverse()delslice() for cases like del a[1:17:2] when a is largeexamples/huffman/compress.py to handle files with 0 or 1 characters,
see also #172skipIf decorator for skipping testsoptimize copy_n() by avoiding loops, #171
resize(), see #167
copy_n() by avoiding loops, #171.bytereverse() no longer sets unused pad bits to zeroenable building wheels for multiple platforms and Python versions using pypa/cibuildwheel, see #165 and #170 (thanks Brian Thorne, @hardbyte)
setup.py, #168.count() step argumentadd optional step argument to .count() method, see #162 and #163
.count() method, see #162 and #163
add optional value parameter to util.count_n(), see #154 and #161
util.count_n(), see #154 and #161
PY_LITTLE_ENDIAN macro, in order to optimize shift_r8()One column per quarter.