{"id":5297,"library":"libipld","title":"libipld","description":"libipld provides Python bindings to a high-performance Rust IPLD library, enabling fast encoding and decoding of IPLD data structures such as DAG-CBOR, CAR files, and CIDs. It's built for efficiency, often used in decentralized web and blockchain applications. The current version is 3.3.2, with active development and frequent minor releases addressing performance and bug fixes.","status":"active","version":"3.3.2","language":"en","source_language":"en","source_url":"https://github.com/MarshalX/python-libipld","tags":["IPLD","CID","DAG-CBOR","CAR","serialization","data structures","decentralized"],"install":[{"cmd":"pip install libipld","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"CID","correct":"from libipld import CID"},{"symbol":"encode_dag_cbor","correct":"from libipld import encode_dag_cbor"},{"symbol":"decode_dag_cbor","correct":"from libipld import decode_dag_cbor"},{"symbol":"decode_car","correct":"from libipld import decode_car"}],"quickstart":{"code":"from libipld import encode_dag_cbor, decode_dag_cbor, CID\n\ndata = {\n    'name': 'IPLD Example',\n    'version': 1,\n    'active': True,\n    'items': [\n        {'id': 1, 'value': 'A'},\n        {'id': 2, 'value': 'B'}\n    ]\n}\n\n# Encode Python dict to DAG-CBOR bytes\nencoded_bytes = encode_dag_cbor(data)\nprint(f\"Encoded DAG-CBOR (first 20 bytes): {encoded_bytes[:20]}...\")\n\n# Decode DAG-CBOR bytes back to Python dict\ndecoded_data = decode_dag_cbor(encoded_bytes)\nprint(f\"Decoded data: {decoded_data}\")\n\n# Create a CID from the encoded bytes (defaults to DAG-CBOR codec, sha2-256 multihash)\ncontent_id = CID.from_bytes(encoded_bytes)\nprint(f\"Generated CID: {content_id}\")\nprint(f\"CID version: {content_id.version}\")\nprint(f\"CID codec: {content_id.codec}\")\nprint(f\"CID multihash: {content_id.multihash.name}\")","lang":"python","description":"This quickstart demonstrates encoding a Python dictionary into DAG-CBOR format, decoding it back, and generating a Content Identifier (CID) from the encoded data. This showcases core `libipld` functionality for structured data serialization and content addressing."},"warnings":[{"fix":"Ensure your code expects and provides `bytes` objects for CIDs, particularly when using `decode_car`, `encode_dag_cbor`, or `CID.from_bytes()`. If migrating from older `libipld` versions, update all CID parsing and serialization logic.","message":"In v2.0.0 and subsequent versions, CIDs in CAR block keys and DAG-CBOR changed from string representation to raw byte representation. This significantly affects how CIDs are handled when interfacing with CAR files or DAG-CBOR directly.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade your Python environment to 3.8 or newer. The library currently supports CPython 3.8 to 3.14.","message":"Python 3.7 support was officially dropped in `libipld` v3.0.0. Projects still using Python 3.7 will need to upgrade their Python environment to at least 3.8 to use v3.0.0 or newer.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"If using PyPy, ensure you are on PyPy 3.11 or a newer supported version. For CPython, versions 3.8-3.14 are supported.","message":"`libipld` dropped support for PyPy 3.8 in v3.0.1, and PyPy 3.9/3.10 in v3.2.0, aligning with their upstream end-of-life status. PyPy 3.11+ is currently supported.","severity":"breaking","affected_versions":">=3.0.1 for PyPy 3.8; >=3.2.0 for PyPy 3.9/3.10"},{"fix":"Upgrade to the latest version of `libipld` (v3.3.0+) to benefit from major performance optimizations for CAR and DAG-CBOR operations, which can be up to 2x faster in some cases.","message":"Earlier versions of `libipld` (before v3.3.0 and v1.2.3) had significantly slower performance for CAR and DAG-CBOR decoding/encoding. Users on older versions might experience substantial performance bottlenecks.","severity":"gotcha","affected_versions":"<3.3.0"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}