{"id":25733757,"url":"https://github.com/nagaokayuji/diff3","last_synced_at":"2025-02-26T04:22:38.961Z","repository":{"id":279083290,"uuid":"937671278","full_name":"nagaokayuji/diff3","owner":"nagaokayuji","description":"A simple implementation of Myers' diff algorithm and a three-way merge algorithm (diff3) in Python.","archived":false,"fork":false,"pushed_at":"2025-02-24T05:58:25.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T06:31:34.355Z","etag":null,"topics":["diff","diff3","myers-algorithm","python3"],"latest_commit_sha":null,"homepage":"","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/nagaokayuji.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-02-23T16:25:07.000Z","updated_at":"2025-02-24T05:58:28.000Z","dependencies_parsed_at":"2025-02-24T06:31:39.432Z","dependency_job_id":"3839ecee-05b9-4a55-bd57-744ca7d234d7","html_url":"https://github.com/nagaokayuji/diff3","commit_stats":null,"previous_names":["nagaokayuji/diff3-python","nagaokayuji/diff3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagaokayuji%2Fdiff3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagaokayuji%2Fdiff3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagaokayuji%2Fdiff3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagaokayuji%2Fdiff3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nagaokayuji","download_url":"https://codeload.github.com/nagaokayuji/diff3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240790290,"owners_count":19858010,"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":["diff","diff3","myers-algorithm","python3"],"created_at":"2025-02-26T04:22:38.019Z","updated_at":"2025-02-26T04:22:38.894Z","avatar_url":"https://github.com/nagaokayuji.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# diff \u0026 diff3 in Python\n\nA simple implementation of Myers' diff algorithm and a three-way merge algorithm (diff3) in Python.\nThis library enables you to compare two sequences efficiently and perform three-way merging for version control or conflict resolution.\n\n## Features\n- Implements **Myers' diff algorithm** for calculating differences between two sequences.\n- Implements **diff3 algorithm** for three-way merging based on the following reference:\n  - https://www.cis.upenn.edu/~bcpierce/papers/diff3-short.pdf\n- **Lightweight and dependency-free**, making it easy to integrate into any project.\n- **Compatible with Python 3.9+**.\n- **No guarantees** on correctness or robustness – use at your own risk.\n- **MIT License** – free to use and modify.\n\n## Installation\n\nYou can install the package via `pip`:\n```sh\npip install git+https://github.com/nagaokayuji/diff3.git\n```\n\nOr, clone the repository and install locally:\n```sh\ngit clone https://github.com/nagaokayuji/diff3.git\ncd diff3\npip install .\n```\n\n## Usage\n\n### diff\n```python\nfrom diff3 import diff\n\noriginal = list(\"ABCABBA\")\ntarget = list(\"CBABAC\")\ndiff_result = diff(original, target)\nprint(diff_result)\n# Output:\n# [- A, - B,   C, + B,   A,   B, - B,   A, + C]\n```\n\n### diff3 (Three-way Merge)\n```python\nfrom diff3 import merge\n\nbase = ['a', 'b', 'c', 'd', 'e']\na = ['a', 'b', 'c', 'cc', 'd', 'e']\nb = ['a', 'c', 'd', 'dd', 'e', 'f']\n\nmerged = merge(base, a, b)\nprint(merged)\n# Output:\n# a\n# c\n# cc\n# d\n# dd\n# e\n# f\n```\n\n## Running Tests\nUnit tests are included. To run all tests, use:\n```sh\nPYTHONPATH=src python -m unittest discover test\n```\n\n## License\nThis project is licensed under the MIT License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnagaokayuji%2Fdiff3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnagaokayuji%2Fdiff3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnagaokayuji%2Fdiff3/lists"}