{ "info": { "author": "Joshua Tauberer", "author_email": "jt@occams.info", "bugtrack_url": null, "classifiers": [], "description": "diff_match_patch-python\n=======================\n\nA Python extension module that wraps google-diff-match-patch's C++ implementation for performing very fast string comparisons.\n\ngoogle-diff-match-patch is a Google library for computing differences between text files (). Thare are implementations in various languages. Although there is a Python port, it's slow on very large documents, and I have a need for speed. I wanted to use the C++ implementation, but I'm a Python guy so I'd prefer to use it from Python.\n\nGoogle's library depends on Qt 4, so some other folks rewrote it using the standard C++ library classes instead, making it more portable. That's at .\n \nThis project is a Python extension module for the C++ STL port so Python code\ncan call into the native library easily. It works in both Python 2 and Python 3.\n\nExample\n-------\n\nFirst::\n\n\tpip3 install diff_match_patch_python\n\nThen write (this is Python 3)::\n\n\tfrom diff_match_patch import diff\n\n\tchanges = diff(\"Hello world.\", \"Goodbye moon.\",\n\t\ttimelimit=0, checklines=False)\n\n\tfor op, length in changes:\n\t\tif op == \"-\": print (\"next\", length, \"characters are deleted\")\n\t\tif op == \"=\": print (\"next\", length, \"characters are in common\")\n\t\tif op == \"+\": print (\"next\", length, \"characters are inserted\")\n\nThe module also provides a method called ``diff_bytes`` for performing a diff on a bytes array.\n\nIn Python 2, the methods are named ``diff_unicode`` (unicode strings) and ``diff_str`` (str strings).\n\nThe ``timelimit`` argument is the maximum running time in seconds if you want to ensure the result comes quickly. According to the Google docs, the diff will stop working after the time is exceeded and will return a valid diff, but it might not be the best one. ``checklines`` is also a Google thing and might speed up diffs that are over lined-based text like code.\n\nThe diff methods also take a ``counts_only`` argument which is ``True`` by default. Set it to ``False`` to have the returned value be an array of tuples of operations and corresponding strings rather than operations and the lengths of those strings.\n\nBuilding from source\n--------------------\n\nTo build from these sources, you will need:\n\n* Python development headers (Debian package ``python-dev``)\n* The diff-match-patch library, which you can clone using ``git submodule update --init``.\n \t\t\nThen build the binary module using::\n\n python setup.py install\n \nOr you may find pre-built binaries stored in the git repository in the build directory.\nYour mileage may vary with these depending on whether your system is compatible.\n\nFor package maintainers\n-----------------------\n\nTo build everything::\n\n git submodule update && rm -rf build && python setup.py build && python3 setup.py build\n\nAnd to test without installing::\n\n PYTHONPATH=build/lib.linux-x86_64-2.7/ python test.py\n PYTHONPATH=build/lib.linux-x86_64-3.4/ python3 test.py", "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/JoshData/diff_match_patch-python", "keywords": "diff compare Google match patch diff_match_patch extension native C fast", "license": "CC0 (copyright waived)", "maintainer": null, "maintainer_email": null, "name": "diff_match_patch_python", "package_url": "https://pypi.org/project/diff_match_patch_python/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/diff_match_patch_python/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/JoshData/diff_match_patch-python" }, "release_url": "https://pypi.org/project/diff_match_patch_python/1.0.2/", "requires_dist": null, "requires_python": null, "summary": "A Python extension module that wraps Google's diff_match_patch C++ implementation for very fast string comparisons. Version 1.0.2 fixes a build issue on Macs.", "version": "1.0.2" }, "last_serial": 2093568, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "ea05c6919aeaa1afd4185c3675379981", "sha256": "d28014997f24f8c616ec7c48e18b232b1b73b21eefdf7adb01f9b9f12b73424d" }, "downloads": -1, "filename": "diff_match_patch_python-1.0.tar.gz", "has_sig": false, "md5_digest": "ea05c6919aeaa1afd4185c3675379981", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29879, "upload_time": "2014-06-26T11:55:58", "url": "https://files.pythonhosted.org/packages/ad/02/037e05e7c95a3513477e161584b30036709034386cb7ac35c307f4dda448/diff_match_patch_python-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "f984c5dce6c5df4aa54b2cea757b23a8", "sha256": "020261e3408f44b93b9cd656c84531f68b7de64da8fb70f16586ed9d01dbac94" }, "downloads": -1, "filename": "diff_match_patch_python-1.0.1.tar.gz", "has_sig": false, "md5_digest": "f984c5dce6c5df4aa54b2cea757b23a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28660, "upload_time": "2014-06-27T19:42:18", "url": "https://files.pythonhosted.org/packages/37/72/865fadff77af131f66fbabb13c37c6f8011c5dd095fc6e5409e9c72d4bb5/diff_match_patch_python-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "0e64663b5e5764947b9f673b4a2a2c08", "sha256": "5a833417344def272ad7dee7c5d455cf3aaf4fb0ffb58029d73e29512dd3ed48" }, "downloads": -1, "filename": "diff_match_patch_python-1.0.2.tar.gz", "has_sig": false, "md5_digest": "0e64663b5e5764947b9f673b4a2a2c08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31491, "upload_time": "2016-05-01T16:07:30", "url": "https://files.pythonhosted.org/packages/a3/16/704cc1a8840eac28bd5d269b133adccecab7dc0d8df733ff50605c67ba50/diff_match_patch_python-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0e64663b5e5764947b9f673b4a2a2c08", "sha256": "5a833417344def272ad7dee7c5d455cf3aaf4fb0ffb58029d73e29512dd3ed48" }, "downloads": -1, "filename": "diff_match_patch_python-1.0.2.tar.gz", "has_sig": false, "md5_digest": "0e64663b5e5764947b9f673b4a2a2c08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31491, "upload_time": "2016-05-01T16:07:30", "url": "https://files.pythonhosted.org/packages/a3/16/704cc1a8840eac28bd5d269b133adccecab7dc0d8df733ff50605c67ba50/diff_match_patch_python-1.0.2.tar.gz" } ] }