{"id":16391732,"url":"https://github.com/williamfzc/difile","last_synced_at":"2025-09-25T16:45:43.782Z","repository":{"id":62568179,"uuid":"276343426","full_name":"williamfzc/difile","owner":"williamfzc","description":"lightweight diff-file library with difflib","archived":false,"fork":false,"pushed_at":"2020-08-12T13:53:05.000Z","size":42,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T19:15:18.877Z","etag":null,"topics":["diff","file-diff","python"],"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/williamfzc.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}},"created_at":"2020-07-01T10:07:31.000Z","updated_at":"2020-08-12T13:53:07.000Z","dependencies_parsed_at":"2022-11-03T16:00:37.307Z","dependency_job_id":null,"html_url":"https://github.com/williamfzc/difile","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fdifile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fdifile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fdifile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fdifile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/williamfzc","download_url":"https://codeload.github.com/williamfzc/difile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240245909,"owners_count":19771028,"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","file-diff","python"],"created_at":"2024-10-11T04:47:11.232Z","updated_at":"2025-09-25T16:45:43.696Z","avatar_url":"https://github.com/williamfzc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# difile\n\n![](https://github.com/williamfzc/difile/workflows/Python%20package/badge.svg)\n[![codecov](https://codecov.io/gh/williamfzc/difile/branch/master/graph/badge.svg)](https://codecov.io/gh/williamfzc/difile)\n\nlightweight diff-file library with difflib\n\n## goal\n\n- something like git-diff but without git\n- programmable\n- dirs and files\n\n## installation\n\n```bash\npip install difile\n```\n\n## usage\n\n### command line\n\n```bash\ndifile compare_file file1.txt file2.txt\ndifile compare_dir dir1 dir2\n```\n\nor a short name:\n\n```bash\ndifile cf file1.txt file2.txt\ndifile cd dir1 dir2\n```\n\n### script\n\ncompare files and get a `List[Line]` object:\n\n```python\nfrom difile import Difile\ndifile = Difile()\n\ndiff_obj = difile.compare_file(\"dirs/dir1/file1.txt\", \"dirs/dir2/file1.txt\")\n```\n\nand you can see what happened between files:\n\n```python\nfor each in diff_obj:\n    print(each.line_no, each.code, each.file_path, each.content.strip())\n```\n\nget:\n\n```text\n1 -  tests/dirs/dir1/file1.txt no\n1 +  tests/dirs/dir2/file1.txt difile\n2 -  tests/dirs/dir1/file1.txt this is file1\n2 +  tests/dirs/dir2/file1.txt that is file1\n3 -  tests/dirs/dir1/file1.txt random\n3 +  tests/dirs/dir2/file1.txt\n4 -  tests/dirs/dir1/file1.txt aha\n```\n\n- line 1: `no` -\u003e `difile`\n- line 2: `this is file1` -\u003e `that is file1`\n- line 3: `random` -\u003e enter\n- line 4: has been removed\n\nof course compare dirs:\n\n```python\nfrom difile import Difile\ndifile = Difile()\n\ndiff_obj = difile.compare_dir(\"dirs/dir1\", \"dirs/dir2\")\n```\n\nyou will get a `List[List[Line]]` object.\n\n## license\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamfzc%2Fdifile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliamfzc%2Fdifile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamfzc%2Fdifile/lists"}