{"id":20793722,"url":"https://github.com/anexia/python-deepcompare","last_synced_at":"2025-05-05T23:42:57.712Z","repository":{"id":57456901,"uuid":"410971749","full_name":"anexia/python-deepcompare","owner":"anexia","description":"A library for deep comparison of data structures consisting of `dict`, `list` and `tuple`.","archived":false,"fork":false,"pushed_at":"2024-11-08T15:10:53.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T00:51:11.855Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anexia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-09-27T17:02:33.000Z","updated_at":"2024-11-08T15:10:31.000Z","dependencies_parsed_at":"2023-11-15T23:46:13.029Z","dependency_job_id":null,"html_url":"https://github.com/anexia/python-deepcompare","commit_stats":null,"previous_names":["anexia-it/python-deepcompare"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anexia%2Fpython-deepcompare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anexia%2Fpython-deepcompare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anexia%2Fpython-deepcompare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anexia%2Fpython-deepcompare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anexia","download_url":"https://codeload.github.com/anexia/python-deepcompare/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252596320,"owners_count":21773842,"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-11-17T16:11:10.594Z","updated_at":"2025-05-05T23:42:57.684Z","avatar_url":"https://github.com/anexia.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"deepcompare\n===========\n\n[![PyPI](https://badge.fury.io/py/deepcompare.svg)](https://pypi.org/project/deepcompare/)\n[![Test Status](https://github.com/anexia/python-deepcompare/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/anexia/python-deepcompare/actions/workflows/test.yml)\n[![Codecov](https://codecov.io/gh/anexia/python-deepcompare/branch/main/graph/badge.svg)](https://codecov.io/gh/anexia/python-deepcompare)\n\n`deepcompare` is a library to deeply compare data structures with each other. It can check if two data\nstructures contain the same data, or if a data structure is a subset of another data structure. The library\nsupports `Sequence` (e.g. `list` or `tuple`) and `Mapping` (e.g. `dict`) types for the deep comparison.\n\n# Installation\n\nWith a [correctly configured](https://pipenv.pypa.io/en/latest/basics/#basic-usage-of-pipenv) `pipenv` toolchain:\n\n```sh\npipenv install python-deepcompare\n```\n\nYou may also use classic `pip` to install the package:\n\n```sh\npip install python-deepcompare\n```\n\n# Getting started\n\n## How it works\n - As a default, the comparison treats all `Sequence` and all `Mapping` types the same (e.g. `(1, 2, 3)` is equal to\n   `[1, 2, 3]`). To enable strict type checks, use the `strict` keyword argument.\n - The `partial_compare` method checks if the data structure given as the second parameter is a subset of the data\n   structure given as the first parameter.\n   - For `Mapping` types this means, that all keys of the second data structure are also keys on the first data\n     structure, and the values of the keys are also equal (e.g. `{'a': 1, 'b': 2}` is a subset\n     of `{'a': 1, 'b': 2, 'c': 3}`, but `{'a': 1, 'b': 2, 'd': 4}` is not).\n   - For `Sequence` types this means, that all values of the second data structure are also values of the first data\n     structure, and the values are in the same order (e.g. `[1, 3, 5]` is a subset\n     of `[1, 2, 3, 4, 5]`, but `[1, 5, 3]` is not).\n\n## Usage\n\n```python\nimport deepcompare\n\n# test if two data structures are equal, but the types to not need to match exactly\ndeepcompare.compare(\n    {'key1': (1, 2, 3), 'key2': {'key3': [4, 5, 6]}},\n    {'key1': [1, 2, 3], 'key2': {'key3': (4, 5, 6)}},\n)  # returns: True\n\n# test if two data structures are equal, and make sure the types match exactly\ndeepcompare.compare(\n    {'key1': (1, 2, 3), 'key2': {'key3': [4, 5, 6]}},\n    {'key1': [1, 2, 3], 'key2': {'key3': (4, 5, 6)}},\n    strict=True,\n)  # returns: False\n\n# test if the second data structure is contained within the first, but\n# the types to not need to match exactly\ndeepcompare.partial_compare(\n    {'key1': (1, 2, 3), 'key2': {'key3': [4, 5, 6]}, 'key4': True},\n    {'key1': [1, 2], 'key2': {'key3': (4, 6)}},\n)  # returns: True\n\n# test if the second data structure is contained within the first, and\n# make sure the types match exactly\ndeepcompare.partial_compare(\n    {'key1': (1, 2, 3), 'key2': {'key3': [4, 5, 6]}, 'key4': True},\n    {'key1': [1, 2], 'key2': {'key3': (4, 6)}},\n    strict=True,\n)  # returns: False\n```\n\n# List of developers\n\n* Andreas Stocker \u003cAStocker@anexia-it.com\u003e, Lead Developer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanexia%2Fpython-deepcompare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanexia%2Fpython-deepcompare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanexia%2Fpython-deepcompare/lists"}