{"id":15486481,"url":"https://github.com/marshalx/python-libipld","last_synced_at":"2025-08-02T09:11:33.637Z","repository":{"id":193129542,"uuid":"686631856","full_name":"MarshalX/python-libipld","owner":"MarshalX","description":"🏎️ Fast Python library to work with IPLD: DAG-CBOR, CID, CAR, multibase","archived":false,"fork":false,"pushed_at":"2024-10-24T11:33:34.000Z","size":4336,"stargazers_count":16,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-25T09:12:34.524Z","etag":null,"topics":["atproto","cid","dag-cbor","decoding","encoding","ipld","multibase"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/libipld/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarshalX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"MarshalX"}},"created_at":"2023-09-03T12:46:11.000Z","updated_at":"2024-10-24T11:28:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"beac8f54-749d-47ec-b1f3-1f480953af28","html_url":"https://github.com/MarshalX/python-libipld","commit_stats":{"total_commits":52,"total_committers":2,"mean_commits":26.0,"dds":"0.019230769230769273","last_synced_commit":"7bf9fb94f368bbbddc7eaf245b08b93c1051aa09"},"previous_names":["marshalx/python-libipld"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshalX%2Fpython-libipld","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshalX%2Fpython-libipld/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshalX%2Fpython-libipld/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshalX%2Fpython-libipld/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarshalX","download_url":"https://codeload.github.com/MarshalX/python-libipld/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252956933,"owners_count":21831407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atproto","cid","dag-cbor","decoding","encoding","ipld","multibase"],"created_at":"2024-10-02T06:08:35.460Z","updated_at":"2025-08-02T09:11:33.622Z","avatar_url":"https://github.com/MarshalX.png","language":"Rust","funding_links":["https://github.com/sponsors/MarshalX"],"categories":[],"sub_categories":[],"readme":"## Python IPLD\n\n\u003e This project aims to speed up [The AT Protocol SDK](https://github.com/MarshalX/atproto) by using Rust for the heavy lifting. Only atproto related parts are implemented first.\n\nCode snippet:\n\n```python\nimport libipld\n\n# CID\nprint(libipld.decode_cid('bafyreig7jbijxpn4lfhvnvyuwf5u5jyhd7begxwyiqe7ingwxycjdqjjoa'))\n# Output: {'hash': {'size': 32, 'code': 18, 'digest': b'\\xdfHP\\x9b\\xbd\\xbcYOV\\xd7\\x14\\xb1{N\\xa7\\x07\\x1f\\xc2C^\\xd8D\\t\\xf44\\xd6\\xbe\\x04\\x91\\xc1)p'}, 'version': 1, 'codec': 113}\nprint(libipld.encode_cid(b'\\x01q\\x12 \\xb6\\x81\\x1a\\x1d\\x7f\\x8c\\x17\\x91\\xdam\\x1bO\\x13m\\xc0\\xe2\u0026y\\xea\\xfe\\xaaX\\xd6M~/\\xaa\\xd5\\x89\\x0e\\x9d\\x9c'))\n# Output: bafyreifwqenb274mc6i5u3i3j4jw3qhcez46v7vkldle27rpvlkysdu5tq\n\n# DAG-CBOR\nprint(libipld.decode_dag_cbor(b'\\xa2aa\\x0cabfhello!'))\n# Output: {'a': 12, 'b': 'hello!'}\nprint(libipld.encode_dag_cbor({'a': 12, 'b': 'hello!'}))\n# Output: b'\\xa2aa\\x0cabfhello!'\n\n# multibase\nprint(libipld.decode_multibase('ueWVzIG1hbmkgIQ'))\n# Output: ('u', b'yes mani !')\nprint(libipld.encode_multibase('u', b'yes mani !'))\n# Output: ueWVzIG1hbmkgIQ\n```\n\n### Features\n\n#### 🔗 CID (Content Identifier) Operations\n- **`decode_cid(data: str | bytes) -\u003e dict`** - Decode CIDs from string representation (e.g., `'bafy...'`) or raw bytes into structured data containing version, codec, and hash information\n- **`encode_cid(data: str | bytes) -\u003e str`** - Encode CID raw bytes to string representation, or return string CIDs as-is\n\n#### 📦 DAG-CBOR (Directed Acyclic Graph CBOR) Operations  \n- **`decode_dag_cbor(data: bytes) -\u003e Any`** - Decode DAG-CBOR binary data into Python objects (dicts, lists, primitives)\n- **`decode_dag_cbor_multi(data: bytes) -\u003e list[Any]`** - Decode multiple concatenated DAG-CBOR objects from a single byte stream\n- **`encode_dag_cbor(data: Any) -\u003e bytes`** - Encode Python objects into DAG-CBOR binary format\n\n#### 🌐 Multibase Operations\n- **`decode_multibase(data: str) -\u003e tuple[str, bytes]`** - Decode multibase-encoded strings, returning the base identifier and decoded data\n- **`encode_multibase(code: str, data: str | bytes) -\u003e str`** - Encode data using specified multibase encoding (e.g., base58btc with code `'u'`)\n\n#### 🚗 CAR (Content Addressable Archives) Operations\n- **`decode_car(data: bytes) -\u003e tuple[dict, dict[bytes, dict]]`** - Decode CAR files into header metadata and a mapping of CID bytes to block data\n\n### Requirements\n\n- Python 3.8 or higher.\n\n### Installing\n\nYou can install or upgrade `libipld` via\n\n```bash\npip install -U libipld\n```\n\n### Contributing\n\nContributions of all sizes are welcome.\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarshalx%2Fpython-libipld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarshalx%2Fpython-libipld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarshalx%2Fpython-libipld/lists"}