{ "info": { "author": "PagesJaunes", "author_email": "fdepaulis@pagesjaunes.fr", "bugtrack_url": null, "classifiers": [], "description": "pydeepdiff\n========\n\n# Description\n\nThis package allows to compute deep differences between two python dictionnaries\n\nDifferences are stored in the following format :\n\nlhs stands for Left Hand Side\nrhs stands for Right Hand Side\n\n- Creation : {'path':path_to_object,'kind':'N','rhs':value}\n- Deletion : {'path':path_to_object,'kind':'D','lhs':value}\n- Edition : {'path':path_to_object,'kind':'E','lhs':value,'rhs':value}\n- Lists\n - Creation : {'path':path_to_object,'kind':'N','rhs_idx':index,'rhs':value}\n - Deletion : {'path':path_to_object,'kind':'D','lhs_idx':index,'lhs':value}\n - Move : {'path':path_to_object,'kind':'M','lhs_idx':index,'rhs_idx':index}\n\n# Requirements\nThis lib requires python 3.2+\n\n# Install\n\n```\n pip install pydeepdiff\n```\n\n# Example of use\n\n```python\n\n from pydeepdiff.diff import get_diff\n\n dict_a = {'field_1': 'id1', 'field_2': 'vala1'}\n dict_b = {'field_1': 'id3', 'field_2': 'valb1'}\n\n differences = get_diff(dict_a, dict_b)\n\n # Differences contains one difference :\n [\n {\n 'path': [\n 'field_1'\n ],\n 'kind': 'E',\n 'lhs': 'id1',\n 'rhs': 'id3'\n },\n {\n 'path': [\n 'field_2'\n ],\n 'kind': 'E',\n 'lhs': 'vala1',\n 'rhs': 'valb1'\n }\n ]\n\n\n dict_a = {'id': '1', 'bloc': {'act': '1'}}\n dict_b = {'id': '1', 'bloc': {'act': '2'}}\n\n differences = get_diff(dict_a, dict_b))\n\n # Differences contains one difference :\n [\n {\n 'path': [\n 'bloc',\n 'act'\n ],\n 'kind': 'E',\n 'lhs': '1',\n 'rhs': '2'\n }\n ]\n```\n\n# Ignored fields\n\nIt is possible to ignore some fields when comparing objects.\nFor this, pass a list of these fields to the comparison function.\n\nExample : don't compare the field 'act' of the nested 'bloc' object :\n\n```python\n\n dict_a = {'id': '1', 'bloc': {'act': '1'}}\n dict_b = {'id': '1', 'bloc': {'act': '2'}}\n\n diff = get_diff(dict_a, dict_b, 'root', {}, ['root.bloc.act'])\n```\n\nIn this example the result is an empty list of differences.\n\n# Specific mapping\n\nWhen comparing two list of dict, we have to \"associate\" each item of the left side list to an item of the right side list.\nFor this, we have to know \"HOW\" making this association : often a dict will have a field that represents its id, and we want to use it.\nIn pydeepdiff, this case is resolved with a mapping file.\n\nIn the following example, we explicitly use the 'field_1' to identify an object of the list.\n\n```python\n\n list_a = [{'field_1': 'id1', 'field_2': 'vala1'}, {'field_1': 'id2', 'field_2': 'vala2'}]\n list_b = [{'field_1': 'id3', 'field_2': 'valb1'}, {'field_1': 'id1', 'field_2': 'valb2'}]\n\n mapping = [{'path': '', 'id': 'field_1'}]\n\n diff = _get_list_dict_diff(list_a, list_b, 'root', mapping, p_complex_details=True)\n```\n\nThe mapping is represented by a list of object. Each object has a :\n* a \"path\" field that contains the json path to the object\n* an \"id\" field that contains the name of the field representing the id of the object (pointed by \"path\")\n\nNote that a path to the root object is the empty string\n\nThe result is the following list of differences :\n\n```\n [\n {'path_to_object': '', 'filter': '', 'rhs_idx': 1, 'lhs_idx': 0, 'kind': 'M'},\n {'rhs': 'valb2', 'lhs': 'vala1', 'kind': 'E', 'path_to_object': '[0].field_2', 'filter': 'field_2'},\n {'lhs_idx': 1, 'kind': 'D', 'lhs': {'field_2': 'vala2', 'field_1': 'id2'}, 'path_to_object': '', 'filter': ''},\n {'rhs_idx': 0, 'kind': 'N', 'rhs': {'field_2': 'valb1', 'field_1': 'id3'}, 'path_to_object': '', 'filter': ''}\n ]\n```\n\n# Tests\n\nTo launch unit tests, just run this command from the project home directory (you will need py.test installed)\n\n```\npy.test test\n\n```", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pagesjaunes/pydeepdiff", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pydeepdiff", "package_url": "https://pypi.org/project/pydeepdiff/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pydeepdiff/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/pagesjaunes/pydeepdiff" }, "release_url": "https://pypi.org/project/pydeepdiff/1.0.3/", "requires_dist": null, "requires_python": null, "summary": "Computes deep differences between objects", "version": "1.0.3" }, "last_serial": 1904107, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "d16a9572933d7c228c212268f2ebcb8b", "sha256": "550c6458f7aba59ae6ca9fa4c2ad7ca7a93fdebf677c0059ef18eb6087c84a79" }, "downloads": -1, "filename": "pydeepdiff-1.0.0.tar.gz", "has_sig": false, "md5_digest": "d16a9572933d7c228c212268f2ebcb8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9244, "upload_time": "2015-12-07T13:52:20", "url": "https://files.pythonhosted.org/packages/6a/37/3e645ac670e8516c8e9166a06863846afe662f42ad56b55b719401656804/pydeepdiff-1.0.0.tar.gz" } ], "1.0.0rc0": [ { "comment_text": "", "digests": { "md5": "c2b5faadc7141c635f96e3751fd7f915", "sha256": "174524a0850dc94fd4ccc6735e84facf01a6bb0098642f256bba1bf77946884b" }, "downloads": -1, "filename": "pydeepdiff-1.0.0rc0.tar.gz", "has_sig": false, "md5_digest": "c2b5faadc7141c635f96e3751fd7f915", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8215, "upload_time": "2015-11-26T14:24:07", "url": "https://files.pythonhosted.org/packages/bd/d3/35296fc69beee5f7064d69271c243a54f523c54f8ce84696708f53c91ab4/pydeepdiff-1.0.0rc0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "be78132c34d9f4f3f119474e0bb09c73", "sha256": "e2cd5a21c51eabe9e08258362902c9431d34968eb026cad09129fe99d0401034" }, "downloads": -1, "filename": "pydeepdiff-1.0.1.tar.gz", "has_sig": false, "md5_digest": "be78132c34d9f4f3f119474e0bb09c73", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9902, "upload_time": "2015-12-10T15:32:45", "url": "https://files.pythonhosted.org/packages/0b/f4/a60cc9a64599d332403b2c58d6a5c045ca68568902e58c4174433a3e937a/pydeepdiff-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "57a5dc119a47b8d9fd0ea1ec4385c6b1", "sha256": "148f4c1376eb7b653016ed57c668ca201a1f6d5996100629c375000eb5e54bd0" }, "downloads": -1, "filename": "pydeepdiff-1.0.2.tar.gz", "has_sig": false, "md5_digest": "57a5dc119a47b8d9fd0ea1ec4385c6b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11503, "upload_time": "2016-01-13T16:21:56", "url": "https://files.pythonhosted.org/packages/aa/55/fc5a90d06faeba3562c73ad0fdfa1730a3ee8e32409028ba4ea511aa44dd/pydeepdiff-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "592b856f3f33f04e3f850ed5b3a6fd22", "sha256": "99951de32cbbbe5306bcab47810a20f125004c57bb8fe94392206794960a7988" }, "downloads": -1, "filename": "pydeepdiff-1.0.3.tar.gz", "has_sig": false, "md5_digest": "592b856f3f33f04e3f850ed5b3a6fd22", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13704, "upload_time": "2016-01-14T10:28:32", "url": "https://files.pythonhosted.org/packages/ee/b8/bf7d49d65797a3a7103535e08fcaadc8be36d3e34a02c0fe2b6e2e7e28da/pydeepdiff-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "592b856f3f33f04e3f850ed5b3a6fd22", "sha256": "99951de32cbbbe5306bcab47810a20f125004c57bb8fe94392206794960a7988" }, "downloads": -1, "filename": "pydeepdiff-1.0.3.tar.gz", "has_sig": false, "md5_digest": "592b856f3f33f04e3f850ed5b3a6fd22", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13704, "upload_time": "2016-01-14T10:28:32", "url": "https://files.pythonhosted.org/packages/ee/b8/bf7d49d65797a3a7103535e08fcaadc8be36d3e34a02c0fe2b6e2e7e28da/pydeepdiff-1.0.3.tar.gz" } ] }