skillfed

tibs

A sleek Python library for binary data.

tibs v2.0.1 4.3M downloads/30d#2,337 on PyPI6
Permissive license The MIT License Copyright (c) 2025 Scott Griffiths (dr.scottgriffiths@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated… (full text in the JSON record) Active released

What it is and what it does

Tibs is a Rust-backed Python library for working with binary data at the bit level rather than the byte level. It provides two main classes: Tibs (immutable bit sequence, analogous to bytes) and Mutibs (mutable variant, analogous to bytearray). The library lets you treat binary data as a container of bits that you can slice, concatenate, and search using familiar Python patterns, extract typed fields (integers, floats, bytes) of arbitrary bit length without manual bit-shifting, and perform bitwise algebra and set operations efficiently.

Common use cases include parsing packet formats, instruction encodings, register layouts, and compressed data where fields don't align to byte boundaries. The library handles little-endian ordering and LSB0 field labeling transparently. A Reader class wraps Tibs to maintain bit position during stream parsing. Tibs is written entirely in Rust with PyO3 bindings and is used to power the bitstring library; it has no runtime dependencies and supports Python 3.11 and later.

Use it for:

  • Parse network packets or protocol messages where fields span non-byte-aligned bit ranges.
  • Decode instruction formats (e.g., eBPF) with mixed endianness and scattered register fields.
  • Implement large bitsets for algorithms like the Sieve of Eratosthenes or fingerprint comparisons.
  • Extract and patch binary data in-place without converting to intermediate representations.
  • Read typed fields (floats, integers) of any bit length from binary streams or files.
  • Perform bitwise set operations (intersection, union, XOR) on large bit sequences efficiently.

Worth the install?

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

Tibs provides immutable and mutable bit-level data structures (Tibs and Mutibs) for working with binary data as sequences of individual bits, supporting typed field extraction, bitwise operations, and searching without byte alignment constraints.

Yes. Tibs is actively maintained, stable (version 2.0), has no known vulnerabilities, and offers a genuinely useful abstraction for bit-level binary work that Python's standard library and most alternatives don't provide cleanly. Medium install friction is acceptable given the compiled-wheel coverage. Permissive MIT license poses no restrictions. Recommended for any project requiring non-byte-aligned binary parsing or bitwise operations.

Install

tibs on PyPI

pip

pip install tibs

uv

uv add tibs

poetry

poetry add tibs

Installing tibs

Before you install

Medium install friction due to compiled Rust components, but pre-built wheels cover most common platforms (macOS, Linux, Windows across multiple architectures). Active maintenance with a release 1 day old and no known vulnerabilities.

License in practice

MIT License permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions—only attribution and license inclusion required.

Quickstart

pip install tibs

from tibs import Tibs
frame = Tibs('0b10110') + b'message' + [0, 0, 0]
pos = frame.find(b'message')
print(pos, frame[pos:pos + 7].bytes)

Requires Python 3.11 or later; pre-built wheels available for most platforms but compilation may be needed on unsupported architectures.

Verify before relying

  • Whether Rust compilation is required on platforms without pre-built wheels and what build dependencies are needed.
  • Performance comparison specifics against bitarray and standard library on typical workloads.
  • Thread-safety guarantees for Mutibs in free-threaded Python builds.

Package facts

License The MIT License Copyright (c) 2025 Scott Griffiths (dr.scottgriffiths@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.11)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 1 days since the last release
Last repo commit
First released
Downloads 4,306,389/month — #2,337 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tibs-2.0.1-cp311-abi3-macosx_10_12_x86_64.whl; tibs-2.0.1-cp311-abi3-macosx_11_0_arm64.whl; tibs-2.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; tibs-2.0.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; tibs-2.0.1-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; tibs-2.0.1-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl; tibs-2.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tibs-2.0.1-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl; tibs-2.0.1-cp311-abi3-musllinux_1_2_aarch64.whl; tibs-2.0.1-cp311-abi3-musllinux_1_2_armv7l.whl; tibs-2.0.1-cp311-abi3-musllinux_1_2_i686.whl; tibs-2.0.1-cp311-abi3-musllinux_1_2_x86_64.whl; tibs-2.0.1-cp311-abi3-win32.whl; tibs-2.0.1-cp311-abi3-win_amd64.whl; tibs-2.0.1-cp311-abi3-win_arm64.whl; tibs-2.0.1-cp314-cp314t-macosx_10_12_x86_64.whl; tibs-2.0.1-cp314-cp314t-macosx_11_0_arm64.whl; tibs-2.0.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; tibs-2.0.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; tibs-2.0.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Free Threading :: 3 - StableProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: RustTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

bit-level binary data structuresbitwise operations pythonbinary packet parsingbit manipulation librarytyped binary field extractionbitset operationsnon-byte-aligned binary data
binary-datarust-backedbitwise-operations

More Python Modules packages