{"id":16355510,"url":"https://github.com/waveform80/cboar","last_synced_at":"2025-10-26T03:31:09.338Z","repository":{"id":142509215,"uuid":"181579031","full_name":"waveform80/cboar","owner":"waveform80","description":"C translation of the cbor2 implementation","archived":true,"fork":false,"pushed_at":"2019-05-13T22:34:31.000Z","size":337,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-29T04:33:10.425Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waveform80.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2019-04-15T23:20:19.000Z","updated_at":"2024-05-02T22:14:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b8978bb-9c07-446f-9582-1441eafc4816","html_url":"https://github.com/waveform80/cboar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waveform80%2Fcboar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waveform80%2Fcboar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waveform80%2Fcboar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waveform80%2Fcboar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waveform80","download_url":"https://codeload.github.com/waveform80/cboar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238254111,"owners_count":19441788,"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":[],"created_at":"2024-10-11T01:41:01.878Z","updated_at":"2025-10-26T03:31:08.623Z","avatar_url":"https://github.com/waveform80.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"=====\nCBOAR\n=====\n\nA high performance, flexible `CBOR serialization`_ library. Basic usage is as\nyou'd expect::\n\n    \u003e\u003e\u003e import cboar as cbor\n    \u003e\u003e\u003e cbor.dumps(0)\n    b'\\x00'\n    \u003e\u003e\u003e cbor.dumps([1, 2, 3])\n    b'\\x83\\x01\\x02\\x03'\n    \u003e\u003e\u003e cbor.loads(cbor.dumps('foo'))\n    'foo'\n\n.. _CBOR serialization: https://cbor.io/\n\nStatus\n======\n\nDon't use this yet! It's not finished although it is approaching an alpha\nrelease. If you're desperate enough to use it, please report any memory leaks\nas issues, and any incorrect encodings / decodings (preferably with easy to\nreproduce test cases).\n\nBe warned that while I've tried to hew closely to the design of cbor2 I have\nmade a few internal changes to keep things easier at the C level so it's never\ngoing to be *exactly* the same. For example, rather than separate decoding\nfunctions called from a CBORDecoder class, it's easier to manage the\nshareable's state by moving the functions into methods on the class itself.\n\nBackground\n==========\n\nOn the `piwheels`_ project we recently switched to CBOR for all our\nserialization needs. Partly this was down to security; we previously used pickle\nbecause it was quick to get started with, but obviously there's *awful* security\nholes there if you can't trust the nodes you're communicating with. Partly it\nwas a matter of flexibility; JSON was considered and quickly rejected for not\nsupporting half the data-types we wanted to transmit (timestamps, durations,\nsets, etc. - half the fun of Python is its rich datatypes!).\n\n.. _piwheels: https://github.com/bennuttall/piwheels\n\nInitially we settled on the `cbor2`_ library; it was extremely flexible and the\ncode looked well written and tested. Unfortunately, while cbor2 is easily fast\nenough for the majority of purposes on a PC, we run piwheels on a pi and when\nchucking around large structures (e.g. the search index) cbor2 took quite a\nwhile to encode things. After a day of tweaking cbor2 to try and improve the\nperformance, and trying pypy3 (nice idea, but it's not ready for primetime yet\nwith various external libraries causing issues), I decided to move to a C-based\nimplementation, specifically the popular `cbor`_ library.\n\n.. _cbor2: https://pypi.org/project/cbor2\n.. _cbor: https://pypi.org/project/cbor\n\nQuickly, we ran into issues: it doesn't support some types out of the box (sets\nand timestamps to name but two). No matter, it was flexible enough to provide a\nmechanism to extend it with new types. Unfortunately, this mechanism isn't as\nwell designed as cbor2's. For instance, patching in set support breaks when\ndealing with, say, sets of tuples (because unlike cbor2 it doesn't know it\nshould switch to immutable hashable collections when decoding within a set, or\nfor dict keys for that matter). Its decoding is also rather basic in several\nareas (the long int decoding runs out of precision after a while, the dict\ndecoding doesn't handle complex keys). After digging into the code to see if\nthese issues could be quickly patched around, I came to the conclusion that its\ninternal design wasn't half as clean (or extensible) as cbor2's.\n\nIf only there was a C-based CBOR implementation that had a design as clean as\ncbor2's, but written in (vaguely) comprehensible C!\n\nWell, after a week mulling it over, here's my shot at it. It's basically a port\nof cbor2 into C. Most of the internal architecture is exactly the same (an\nOrderedDict to look up types, an identical default encoder mechanism, etc), so\nI've licensed it the same as cbor2 because for all intents and purposes, it's a\nderivative work (hell, I even nicked their test suite).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaveform80%2Fcboar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaveform80%2Fcboar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaveform80%2Fcboar/lists"}