{"id":13725414,"url":"https://github.com/csernazs/cowdict","last_synced_at":"2025-10-31T04:47:09.869Z","repository":{"id":62565071,"uuid":"115870384","full_name":"csernazs/cowdict","owner":"csernazs","description":"Copy-on-write dictionary","archived":false,"fork":false,"pushed_at":"2018-01-06T10:53:26.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-09T13:15:03.364Z","etag":null,"topics":["library","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/csernazs.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-31T15:20:53.000Z","updated_at":"2023-06-20T19:17:31.000Z","dependencies_parsed_at":"2022-11-03T16:15:20.100Z","dependency_job_id":null,"html_url":"https://github.com/csernazs/cowdict","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csernazs%2Fcowdict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csernazs%2Fcowdict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csernazs%2Fcowdict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csernazs%2Fcowdict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csernazs","download_url":"https://codeload.github.com/csernazs/cowdict/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224645365,"owners_count":17346135,"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":["library","python3"],"created_at":"2024-08-03T01:02:22.443Z","updated_at":"2025-10-31T04:47:09.783Z","avatar_url":"https://github.com/csernazs.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"cowdict\n~~~~~~~\n\ncowdict is a python module implementing copy-on-write pattern on dictionaries.\n\nThis means that if someone changes the dict-like object, the original object won't be changed but\nthe differences will be tracked instead.\n\nNutshell\n--------\n\nHere's a small example:\n\n.. code-block:: python\n\n    base_dict = {\"foo\": \"bar\"}\n    cd = CowDict(base_dict)\n    cd[\"foo\"] = \"baz\"\n\n    print(base_dict[\"foo\"]) # will still print 'bar'\n    print(cd[\"foo\"]) # will print 'baz'\n\nCowDict object (`cd` in the code above) implements the `MutableMapping` interface, simply speaking it has the\nsame interface as the `dict` object.\n\nThis means that it is guaranteed that changing keys/values on this object will never cause the change of the\nunderlying dictionary (`base_dict` in the example).\n\nPhilosophy\n----------\nThe idea behind this module is to avoid copying dictionary where it is possible and use this wrapper class instead.\nWhile it has some penalties on the performance on key look-up and length calculation, the memory footprint can\nbe kept at minimum (compared to a full copy of the dictionary).\n\n\nBehind the scenes\n-----------------\nBehind the scenes, new items are added to a separate directory. Keys which exist on the base dictionary are\n'deleted' by keeping a separate set object about the the keys deleted.\nEvery time when a key is accessed either by `__getitem__` or `items` or other methods,\nthese additional structures are involved to produce the correct result.\n\nWhile having an assumption of having the base dictionary read-only would make the world easier, especially\nwhen calculating the length of the object, the library handles the situation when the base dictionary changes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsernazs%2Fcowdict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsernazs%2Fcowdict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsernazs%2Fcowdict/lists"}