deepcomparer


Namedeepcomparer JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/jparadadev/deepcomparer.py
SummaryDeep compare python structures like dictionaries, lists and iterables.
upload_time2023-01-01 12:07:18
maintainer
docs_urlNone
authorJavier Parada
requires_python>=3.7
licenseMIT
keywords compare dictionary list array deep find structure nested data
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Deepcomparer

![](https://img.shields.io/badge/PRs-welcome-green.svg)
[![GitHub](https://img.shields.io/github/license/jparadadev/deepcomparer.py)](https://github.com/jparadadev/deepcomparer.py/blob/main/LICENSE)
[![Pypi](https://img.shields.io/pypi/v/deepcomparer)](https://pypi.org/project/deepcomparer/)
[![Downloads](https://pepy.tech/badge/deepcomparer)](https://pepy.tech/project/deepcomparer)
[![GA](https://github.com/jparadadev/deepcomparer.py/workflows/Tests/badge.svg)](https://github.com/jparadadev/deepcomparer.py/actions/workflows/test.yml)

Deep compare python objects and structures like dictionaries, lists and iterables.

## Getting Started

### Installation

```Shell
  pip install deepcomparer
```

### Usage

```python
from deepcomparer import deep_compare

class Pokemon:
    def __init__(self, name):
        self.name = name

user: dict = {
    'name': 'ash',
    'links': {
        'pokehub': '@ash'
    },
    'pokemons': [Pokemon('pikachu')]
}

user2: dict = {
    'name': 'ash',
    'links': {
        'pokehub': '@ash'
    },
    'pokemons': [Pokemon('geodude')]
}
print(deep_compare(user, user2))
# output: False

user2['pokemons'] = [Pokemon('pikachu')]
print(deep_compare(user, user2))
# output: True

```


```python
from deepcomparer import deep_compare

ash_data: dict = {
    'name': 'ash',
    'links': {
        'pokehub': '@ash'
    }
}

brock_data: dict = {
    'name': 'brock',
    'links': {
        'pokehub': '@brock'
    }
}

# Over iterable structures
print(deep_compare([ash_data, brock_data], [ash_data, brock_data]))
# output: True

# Over iterable structures
print(deep_compare([ash_data, brock_data], [brock_data, ash_data]))
# output: False

# Over unsorted iterable structures
print(deep_compare([ash_data, brock_data], [brock_data, ash_data], ignore_order=True))
# output: True
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jparadadev/deepcomparer.py",
    "name": "deepcomparer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "compare,dictionary,list,array,deep,find,structure,nested,data",
    "author": "Javier Parada",
    "author_email": "javierparadadev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4b/33/84a4de3c7081ea7132d6dcae54243ec56f1a77bb7f30f184f0fe7813ea73/deepcomparer-0.4.0.tar.gz",
    "platform": "any",
    "description": "# Deepcomparer\n\n![](https://img.shields.io/badge/PRs-welcome-green.svg)\n[![GitHub](https://img.shields.io/github/license/jparadadev/deepcomparer.py)](https://github.com/jparadadev/deepcomparer.py/blob/main/LICENSE)\n[![Pypi](https://img.shields.io/pypi/v/deepcomparer)](https://pypi.org/project/deepcomparer/)\n[![Downloads](https://pepy.tech/badge/deepcomparer)](https://pepy.tech/project/deepcomparer)\n[![GA](https://github.com/jparadadev/deepcomparer.py/workflows/Tests/badge.svg)](https://github.com/jparadadev/deepcomparer.py/actions/workflows/test.yml)\n\nDeep compare python objects and structures like dictionaries, lists and iterables.\n\n## Getting Started\n\n### Installation\n\n```Shell\n  pip install deepcomparer\n```\n\n### Usage\n\n```python\nfrom deepcomparer import deep_compare\n\nclass Pokemon:\n    def __init__(self, name):\n        self.name = name\n\nuser: dict = {\n    'name': 'ash',\n    'links': {\n        'pokehub': '@ash'\n    },\n    'pokemons': [Pokemon('pikachu')]\n}\n\nuser2: dict = {\n    'name': 'ash',\n    'links': {\n        'pokehub': '@ash'\n    },\n    'pokemons': [Pokemon('geodude')]\n}\nprint(deep_compare(user, user2))\n# output: False\n\nuser2['pokemons'] = [Pokemon('pikachu')]\nprint(deep_compare(user, user2))\n# output: True\n\n```\n\n\n```python\nfrom deepcomparer import deep_compare\n\nash_data: dict = {\n    'name': 'ash',\n    'links': {\n        'pokehub': '@ash'\n    }\n}\n\nbrock_data: dict = {\n    'name': 'brock',\n    'links': {\n        'pokehub': '@brock'\n    }\n}\n\n# Over iterable structures\nprint(deep_compare([ash_data, brock_data], [ash_data, brock_data]))\n# output: True\n\n# Over iterable structures\nprint(deep_compare([ash_data, brock_data], [brock_data, ash_data]))\n# output: False\n\n# Over unsorted iterable structures\nprint(deep_compare([ash_data, brock_data], [brock_data, ash_data], ignore_order=True))\n# output: True\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Deep compare python structures like dictionaries, lists and iterables.",
    "version": "0.4.0",
    "split_keywords": [
        "compare",
        "dictionary",
        "list",
        "array",
        "deep",
        "find",
        "structure",
        "nested",
        "data"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "279df7a8c68a6a7aa5ddae4de8c2f05b",
                "sha256": "89d92f2c14e0d7afc9451739fc1228a46028054182b1387a5710a7ad2cf4d46b"
            },
            "downloads": -1,
            "filename": "deepcomparer-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "279df7a8c68a6a7aa5ddae4de8c2f05b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3612,
            "upload_time": "2023-01-01T12:07:17",
            "upload_time_iso_8601": "2023-01-01T12:07:17.718298Z",
            "url": "https://files.pythonhosted.org/packages/00/63/815fc0dacdd898cfa9e9145982fbac94160581170e6a5dc51cc0abe8b43c/deepcomparer-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "44a7cd1da39b7158103a89adc0d774f9",
                "sha256": "c99a1fd328b350bbdfcf597f61e1cfb76d150c38dedf46ec709bf5eeeb7b88de"
            },
            "downloads": -1,
            "filename": "deepcomparer-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "44a7cd1da39b7158103a89adc0d774f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3230,
            "upload_time": "2023-01-01T12:07:18",
            "upload_time_iso_8601": "2023-01-01T12:07:18.925051Z",
            "url": "https://files.pythonhosted.org/packages/4b/33/84a4de3c7081ea7132d6dcae54243ec56f1a77bb7f30f184f0fe7813ea73/deepcomparer-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-01 12:07:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "jparadadev",
    "github_project": "deepcomparer.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "deepcomparer"
}
        
Elapsed time: 0.02380s