{"id":3294,"library":"tibs","title":"Tibs - Binary Data Handling","description":"tibs is a sleek Python library designed for creating, interpreting, and manipulating binary data. Written 100% in Rust for excellent performance, it provides efficient handling of bit sequences. The current version is 0.6.0. Releases appear to be event-driven rather than on a fixed cadence, with a focus on performance and robust binary data operations.","status":"active","version":"0.6.0","language":"en","source_language":"en","source_url":"https://github.com/scott-griffiths/tibs","tags":["binary data","bit manipulation","performance","rust","immutable","mutable"],"install":[{"cmd":"pip install tibs","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"symbol":"Tibs","correct":"from tibs import Tibs"},{"symbol":"Mutibs","correct":"from tibs import Mutibs"}],"quickstart":{"code":"from tibs import Tibs, Mutibs\n\n# Create immutable Tibs instances\na = Tibs.from_bin('0110')\nb = Tibs('0xabc') # Constructor can infer from string/bytes\nc = Tibs.from_bytes(b'\\xff\\x00')\n\nprint(f\"Tibs from binary: {a.to_bin()}\")\nprint(f\"Tibs from hex: {b.to_hex()}\")\nprint(f\"Tibs from bytes: {c.to_hex()}\")\n\n# Create a mutable Mutibs instance\nmuti = Mutibs.from_bin('1010')\nmuti.append('01')\nprint(f\"Mutable Tibs after append: {muti.to_bin()}\")\n\n# Combine multiple Tibs instances efficiently\ndata_parts = [Tibs('0b1'), Tibs('0b010'), Tibs('0b1100')]\ncombined_tibs = Tibs.from_joined(data_parts)\nprint(f\"Combined Tibs: {combined_tibs.to_bin()}\")","lang":"python","description":"This quickstart demonstrates how to create immutable `Tibs` and mutable `Mutibs` instances from various sources like binary strings, hexadecimal strings, and bytes. It also shows how to efficiently combine multiple `Tibs` objects using `from_joined`."},"warnings":[{"fix":"For efficient concatenation of multiple `Tibs` instances, use the `Tibs.from_joined()` class method. If you require a mutable sequence of bits, use the `Mutibs` class instead, which supports in-place modifications.","message":"Instances of `Tibs` are immutable. Repeatedly concatenating or appending to a `Tibs` instance using operators like `+=` is an anti-pattern, as it creates a new instance in memory on each operation, leading to poor performance.","severity":"gotcha","affected_versions":"All versions (0.1.0+)"},{"fix":"Always use `0b` for binary strings (e.g., `Tibs('0b0110')`) and `0x` for hexadecimal strings (e.g., `Tibs('0xabc')`) when passing them to the `Tibs` constructor. Alternatively, use the explicit class methods like `Tibs.from_bin('0110')` or `Tibs.from_hex('abc')`.","message":"When constructing `Tibs` instances directly with string representations of binary or hexadecimal values (e.g., `Tibs('0110')`), you must include the '0b' or '0x' prefixes. Methods like `Tibs.from_bin()` or `Tibs.from_hex()` handle this prefixing implicitly.","severity":"gotcha","affected_versions":"All versions (0.1.0+)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}