--- id: cobs version: "1.2.2" license: ---------------------------------------------------------------------------- Copyright (c) 2010 Craig McQueen Permission is hereby granted, free of charge, to any person obtaining a copy of this… (full text in the JSON record) license_treatment: permissive maintenance: aging --- # cobs — Consistent Overhead Byte Stuffing (COBS) License: permissive · Maintenance: aging · Downloads: 119.2K/mo ## What it is and what it does COBS is a byte-stuffing algorithm that encodes arbitrary binary data into a form containing no zero bytes (0x00), enabling zero bytes to serve as reliable packet delimiters in serial and network protocols. The package provides both basic COBS and COBS/R (a variant that reduces overhead) via Python modules with encode and decode functions. It includes a C extension for performance and a pure Python fallback for portability. The encoding adds predictable overhead: always 1 byte plus potentially n/254 additional bytes for longer packets. This is more efficient than escape-based methods like PPP, which can double packet size in worst cases. The package accepts any buffer-protocol-compatible input (bytes, bytearray) and returns encoded/decoded bytes; framing (adding or stripping delimiter bytes) is left to the application. Use it for: - Implement packet framing in serial communication protocols where zero bytes mark packet boundaries. - Encode binary data for transmission over channels that cannot safely transmit zero bytes. - Reduce packet size overhead compared to escape-based byte stuffing in bandwidth-constrained protocols. - Use COBS/R variant to minimize encoding overhead for small message payloads in embedded systems. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Encodes and decodes data using Consistent Overhead Byte Stuffing (COBS), a method that eliminates zero bytes from encoded packets to enable reliable packet framing in communication protocols. Yes. COBS is a well-established, stable algorithm with a mature implementation (Production/Stable, MIT license). Install it if you need reliable packet framing in serial/network protocols or must eliminate zero bytes from binary data. Medium install friction is acceptable given the C extension fallback. No known vulnerabilities. ## Install pip install cobs uv add cobs poetry add cobs ## Installing cobs Before you install: Medium install friction due to C extension compilation; pure Python fallback available. Package is stable (Production/Stable status) and actively maintained with recent release (2025-07-20), though maintenance cadence is aging. License in practice: MIT license (permissive) allows unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects. Quickstart: pip install cobs from cobs import cobs encoded = cobs.encode(b'Hello world\x00This is a test') decoded = cobs.decode(encoded) Requires Python >= 3.6; C extension compilation may fail on some platforms, but pure Python implementation is available as fallback. Verify before relying: - Performance characteristics of C extension vs. pure Python implementation for typical packet sizes. - Whether the package handles edge cases like empty input or maximum-length packets as documented. ## Package facts - License: ---------------------------------------------------------------------------- Copyright (c) 2010 Craig McQueen Permission is hereby granted, free of charge, to any person obtaining a copy of this… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: medium - Maintenance: aging - Downloads: 119.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags byte stuffing encoding, cobs packet framing, zero byte elimination, serial protocol encoding, packet boundary delimiter, communication protocol encoding, cobs/r reduced overhead, packet-framing, serial-protocol, byte-encoding [View on SkillFed](https://skillfed.io/packages/cobs) · [View on PyPI](https://pypi.org/project/cobs/)