--- id: tibs version: "2.0.1" 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) license_treatment: permissive maintenance: active --- # tibs — A sleek Python library for binary data. License: permissive · Maintenance: active · Downloads: 4.3M/mo ## 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 above — 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 pip install tibs uv add tibs 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_current - Install friction: medium - Maintenance: active - Downloads: 4.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags bit-level binary data structures, bitwise operations python, binary packet parsing, bit manipulation library, typed binary field extraction, bitset operations, non-byte-aligned binary data, binary-data, rust-backed, bitwise-operations [View on SkillFed](https://skillfed.io/packages/tibs) · [View on PyPI](https://pypi.org/project/tibs/)