skillfed

intbitset

C-based extension implementing fast integer bit sets.

intbitset v4.1.2 136.1K downloads/30d#11,407 on PyPI22
Copyleft license LGPL-3.0-or-later Active released

What it is and what it does

intbitset is a C-based Python extension that implements a set class for storing sorted unsigned integers using bit vectors. It emulates the Python built-in set interface—supporting union, intersection, difference, and standard set operations—while delivering faster performance and lower memory usage for dense integer collections. The library supports pickling, iteration, slicing, and fast min/max access since integers are always stored sorted.

You would use intbitset when you need to perform repeated set operations on large collections of integers and performance or memory efficiency matters. It trades the flexibility of storing arbitrary Python objects (which the standard set does) for speed and compactness when your data is integers. The package has no runtime dependencies and is actively maintained; wheels are available for modern Python versions and common platforms, though building from source requires a C compiler.

Use it for:

  • Filtering and intersecting large integer collections in data processing pipelines where speed is critical.
  • Storing and querying membership in dense integer ranges (e.g., document IDs, user IDs) in search or database systems.
  • Performing fast set algebra (union, difference) on integer sequences in scientific or statistical computations.
  • Building inverted indexes or bit-level data structures where integer set operations are the core operation.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

intbitset provides a fast, memory-efficient set implementation for storing sorted unsigned integers using bit vectors, implemented as a Python C extension with set operations significantly faster than the standard library set for dense integer collections.

Yes, if you work with dense integer sets and need fast set operations. The package is actively maintained, has no dependencies, and offers pre-built wheels for common platforms. The copyleft license (LGPL-3.0-or-later) requires derivative works to use the same license, so review compliance before use in proprietary code. No known vulnerabilities.

Install

intbitset on PyPI

pip

pip install intbitset

uv

uv add intbitset

poetry

poetry add intbitset

Installing intbitset

Before you install

Wheels are pre-built for common platforms and Python versions, reducing installation friction. The package is actively maintained with a recent release and no runtime dependencies, though building from source requires a C compiler.

License in practice

intbitset is licensed under LGPL-3.0-or-later (copyleft). Derivative works and modifications must be distributed under the same or compatible license; proprietary closed-source applications using this library must comply with copyleft obligations or obtain a commercial license.

Quickstart

pip install intbitset

from intbitset import intbitset
x = intbitset([1, 2, 3])
y = intbitset([3, 4, 5])
result = x & y  # intersection
print(result)  # intbitset([3])

Building from source requires a C compiler; pre-built wheels are available for most common platforms and Python versions.

Verify before relying

  • Whether the performance advantage applies to your specific use case (dense vs. sparse sets, set size, operation patterns).
  • Exact memory overhead compared to standard set for your typical integer ranges and densities.
  • Support for Python versions beyond 3.10–3.12.

Package facts

License LGPL-3.0-or-later (copyleft)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 108 days since the last release
Last repo commit
First released
Downloads 136,067/month — #11,407 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: intbitset-4.1.2-cp310-cp310-macosx_10_9_universal2.whl; intbitset-4.1.2-cp310-cp310-macosx_11_0_arm64.whl; intbitset-4.1.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; intbitset-4.1.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; intbitset-4.1.2-cp310-cp310-musllinux_1_2_aarch64.whl; intbitset-4.1.2-cp310-cp310-musllinux_1_2_x86_64.whl; intbitset-4.1.2-cp310-cp310-win_amd64.whl; intbitset-4.1.2-cp311-cp311-macosx_10_9_universal2.whl; intbitset-4.1.2-cp311-cp311-macosx_11_0_arm64.whl; intbitset-4.1.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; intbitset-4.1.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; intbitset-4.1.2-cp311-cp311-musllinux_1_2_aarch64.whl; intbitset-4.1.2-cp311-cp311-musllinux_1_2_x86_64.whl; intbitset-4.1.2-cp311-cp311-win_amd64.whl; intbitset-4.1.2-cp312-cp312-macosx_10_13_universal2.whl; intbitset-4.1.2-cp312-cp312-macosx_11_0_arm64.whl; intbitset-4.1.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; intbitset-4.1.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; intbitset-4.1.2-cp312-cp312-musllinux_1_2_aarch64.whl; intbitset-4.1.2-cp312-cp312-musllinux_1_2_x86_64.whl

Environment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)Operating System :: OS IndependentProgramming Language :: CProgramming Language :: CythonProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

fast integer set operationsbit vector set implementationdense integer storageoptimized set data structurememory-efficient integer setsbitset library pythonhigh-performance set operations
data-structuresperformance-criticalc-extension

More Python Modules packages