{"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":"python","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,"search_vec":"'0.6.0':37 '100':20 'appear':39 'binari':2,17,58,61 'bit':31,63 'cadenc':50 'creat':13 'current':34 'data':3,18,59,62 'design':11 'driven':44 'effici':28 'event':43 'event-driven':42 'excel':24 'fix':49 'focus':53 'handl':4,29 'immut':67 'interpret':14 'librari':10 'manipul':16,64 'mutabl':68 'oper':60 'perform':25,55,65 'provid':27 'python':9 'rather':45 'releas':38 'robust':57 'rust':22,66 'sequenc':32 'sleek':8 'tib':1,5 'version':35 'written':19","created_at":"2026-04-11T09:29:20.386577+00:00","updated_at":"2026-04-16T22:56:44.997297+00:00","problems":[{"fix":"Install the 'tibs' library using pip: `pip install tibs`","cause":"The 'tibs' package is not installed in the current Python environment or the environment is not activated.","error":"ModuleNotFoundError: No module named 'tibs'"},{"fix":"Install the Rust toolchain using `rustup.rs` before attempting to install `tibs`. Follow instructions at `https://rustup.rs/`.","cause":"The Rust compiler (`rustc`) is not installed or not available in the system's PATH, which is required to build the `tibs` library from source.","error":"error: can't find rustc"},{"fix":"Use the correct class name `BitVec` when importing: `from tibs import BitVec`","cause":"The class 'BitVector' does not exist or is not directly exposed under that name in the 'tibs' top-level package; the correct class name is 'BitVec'.","error":"ImportError: cannot import name 'BitVector' from 'tibs'"},{"fix":"Ensure you provide a string value to `BitVec.from_string()`. For example, use `BitVec.from_string(str(123))` if you intend to convert an integer to its string representation.","cause":"The `BitVec.from_string()` method expects a string argument, but it received an integer, leading to a type conversion error in the underlying Rust implementation.","error":"TypeError: argument 's': 'int' object cannot be converted to 'PyString'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.0.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/scott-griffiths/tibs","docs":"https://mutibs.readthedocs.io/","changelog":null,"pypi":"https://pypi.org/project/tibs/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}