{"id":15395459,"url":"https://github.com/stef/objchanges","last_synced_at":"2025-03-27T20:44:50.368Z","repository":{"id":66440208,"uuid":"173859879","full_name":"stef/objchanges","owner":"stef","description":"diffs and patches python objects","archived":false,"fork":false,"pushed_at":"2020-05-20T19:29:04.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T23:17:19.754Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-03-05T02:43:06.000Z","updated_at":"2023-09-08T17:51:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb92c8a2-4a02-4dce-b4aa-8e90bb8a5ffc","html_url":"https://github.com/stef/objchanges","commit_stats":{"total_commits":44,"total_committers":2,"mean_commits":22.0,"dds":"0.045454545454545414","last_synced_commit":"26714f24374b5384af63d39f48b0296ba88dafa4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fobjchanges","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fobjchanges/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fobjchanges/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fobjchanges/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stef","download_url":"https://codeload.github.com/stef/objchanges/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245924494,"owners_count":20694728,"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-01T15:28:25.485Z","updated_at":"2025-03-27T20:44:50.344Z","avatar_url":"https://github.com/stef.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"!objchanges\n\ncan diff simple python objects consisting only of dicts/lists/atomic types, but\nis also able to apply the diffs as patches to existing objects. also included\nis a fuzzer that creates random objects to test objchanges.\n\nif the objects are supported this should work fine\n```\n    assert diff(new, patch(old, diff(old, new))) in [None, []]\n    assert diff(old, revert(new, diff(old, new))) in [None, []]\n```\n\nyou can now also display the changes nicely formatted in a ANSI terminal:\n\n```\n   old = {...}\n   new = {... something changed ... }\n   d = diff(old,new)\n   print(contextdiff(new, p))\n```\n\n!!cmdline\n\nyou can also invoke objchanges directly on json files:\n\n```\n% cat new\n{\"a\": [{\"5\": {\"1\": 3}, \"2\": {\"2\": \"sZ5\"}}, [\"ezw\", []]], \"1\": 23, \"c\": \"m0L\"}\n% cat old\n{\"a\": [{\"5\": {\"1\": 3}, \"2\": {\"2\": \"sZ5\"}}, [\"ezw\"]], \"1\": 23, \"c\": \"m0L\"}\n\n# running simple diff\n% ./objchanges.py diff old new\n[{\"type\": \"added\", \"path\": [\"a\", 1], \"data\": [\"ezw\", []]}, {\"type\": \"deleted\", \"path\": [\"a\", 1], \"data\": [\"ezw\"]}]\n\n# patching old with diff\n% ./objchanges.py patch old \u003c(./objchanges.py diff old new)\n{\"a\": [{\"5\": {\"1\": 3}, \"2\": {\"2\": \"sZ5\"}}, [\"ezw\", []]], \"1\": 23, \"c\": \"m0L\"}\n\n# reverting new with diff\n% ./objchanges.py revert new \u003c(./objchanges.py diff old new)\n{\"a\": [{\"5\": {\"1\": 3}, \"2\": {\"2\": \"sZ5\"}}, [\"ezw\"]], \"1\": 23, \"c\": \"m0L\"}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstef%2Fobjchanges","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstef%2Fobjchanges","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstef%2Fobjchanges/lists"}