# `diffant`
`diffant` uses the structure of configuration files to do a more helpful comparison than standard diff.
`diffant` allows you to compare:
* ini
* json
* yaml
For example, for the purpose of comparing configuration, these two files are the same. There should be no diff:
| file_01.ini | file_02.ini |
| ----------------------- | ------------------------- |
| `[info]` | `[info]` |
| `email=bob@example.com` | `phone=212-555-1212` |
| `phone=212-555-1212` | `email = bob@example.com` |
`diffant` can meaningfully compare a heavily commented original configuration file with many lines to a minimized comment-less configuration file and find how the defaults have changed.
You are not limited to comparing 2 files, `diffant` can compare many files.
## SAMPLE OUTPUT
```
fruit: apple
tests/sample_input.dirs/simple/file01.json
tests/sample_input.dirs/simple/file03.json
cherry
tests/sample_input.dirs/simple/file02.json
/*MISSING*/
tests/sample_input.dirs/simple/file04.json
grain: rice
tests/sample_input.dirs/simple/file01.json
/*MISSING*/
tests/sample_input.dirs/simple/file02.json
tests/sample_input.dirs/simple/file03.json
tests/sample_input.dirs/simple/file04.json
inspiration:art: Pablo Picasso
tests/sample_input.dirs/simple/file01.json
tests/sample_input.dirs/simple/file03.json
Frida Kahlo
tests/sample_input.dirs/simple/file02.json
/*MISSING*/
tests/sample_input.dirs/simple/file04.json
inspiration:music: Dead Kennedys
tests/sample_input.dirs/simple/file01.json
tests/sample_input.dirs/simple/file02.json
tests/sample_input.dirs/simple/file03.json
/*MISSING*/
tests/sample_input.dirs/simple/file04.json
inspiration:tools:0: hammer
tests/sample_input.dirs/simple/file02.json
/*MISSING*/
tests/sample_input.dirs/simple/file01.json
tests/sample_input.dirs/simple/file03.json
tests/sample_input.dirs/simple/file04.json
inspiration:tools:1: rack
tests/sample_input.dirs/simple/file02.json
/*MISSING*/
tests/sample_input.dirs/simple/file01.json
tests/sample_input.dirs/simple/file03.json
tests/sample_input.dirs/simple/file04.json
vegetable: spinach
tests/sample_input.dirs/simple/file03.json
/*MISSING*/
tests/sample_input.dirs/simple/file01.json
tests/sample_input.dirs/simple/file02.json
tests/sample_input.dirs/simple/file04.json
```
## SAMPLE INPUT
### file01.json
```json
{
"grain": "rice",
"color": "red",
"fruit": "apple",
"inspiration": {"art":"Pablo Picasso","music":"Dead Kennedys"}
}
```
### file02.json
```json
{
"color": "red",
"fruit": "cherry",
"inspiration": {"art":"Frida Kahlo","music":"Dead Kennedys","tools":["hammer","rack"]}
}
```
### file03.json
```json
{
"vegetable": "spinach",
"color": "red",
"fruit": "apple",
"inspiration": {"art":"Pablo Picasso","music":"Dead Kennedys"}
}
```
### file04.json
```json
{
"color": "red"
}
```
## REQUIREMENTS
* pip
* python >= 3.8
## LICENSE
GNU General Public License v3.0
## SETUP
```
pip3 install diffant
```
## USAGE
```
diffant <directory with files of same type>
```
## BUGS
1. The files you are comparing need to be at the top level of a directory that you supply as a positional argument to `diffant`
1. The files need to have an extension that reflects their contents (ini,json.yml)
1. You can't compare files of different types or have files of different types in your input directory.
## SUPPORT
dan@omacneil.org
## CONTRIBUTORS
* @morgan: Helpful tweak to README.md
* [cpat-gpt](https://chat.openai.com/): about 50% of the code
Raw data
{
"_id": null,
"home_page": "https://github.com/omacneil/diffant",
"name": "diffant",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.1,<4.0.0",
"maintainer_email": "",
"keywords": "json,yaml,ini,diff,configuration,compare",
"author": "omacneil",
"author_email": "dan@omacneil.org",
"download_url": "https://files.pythonhosted.org/packages/cc/5b/2623eddbaf9b0ce6a16b1c7b77af1434f219aeab4c121e3756fd09b249b5/diffant-1.0.3.tar.gz",
"platform": null,
"description": "# `diffant`\n`diffant` uses the structure of configuration files to do a more helpful comparison than standard diff.\n\n`diffant` allows you to compare:\n\n* ini\n* json\n* yaml\n\nFor example, for the purpose of comparing configuration, these two files are the same. There should be no diff:\n\n| file_01.ini | file_02.ini |\n| ----------------------- | ------------------------- |\n| `[info]` | `[info]` |\n| `email=bob@example.com` | `phone=212-555-1212` |\n| `phone=212-555-1212` | `email = bob@example.com` |\n\n`diffant` can meaningfully compare a heavily commented original configuration file with many lines to a minimized comment-less configuration file and find how the defaults have changed.\n\nYou are not limited to comparing 2 files, `diffant` can compare many files.\n\n## SAMPLE OUTPUT\n```\nfruit: apple\n tests/sample_input.dirs/simple/file01.json\n tests/sample_input.dirs/simple/file03.json\n\n cherry\n tests/sample_input.dirs/simple/file02.json\n\n /*MISSING*/\n tests/sample_input.dirs/simple/file04.json\n\ngrain: rice\n tests/sample_input.dirs/simple/file01.json\n\n /*MISSING*/\n tests/sample_input.dirs/simple/file02.json\n tests/sample_input.dirs/simple/file03.json\n tests/sample_input.dirs/simple/file04.json\n\ninspiration:art: Pablo Picasso\n tests/sample_input.dirs/simple/file01.json\n tests/sample_input.dirs/simple/file03.json\n\n Frida Kahlo\n tests/sample_input.dirs/simple/file02.json\n\n /*MISSING*/\n tests/sample_input.dirs/simple/file04.json\n\ninspiration:music: Dead Kennedys\n tests/sample_input.dirs/simple/file01.json\n tests/sample_input.dirs/simple/file02.json\n tests/sample_input.dirs/simple/file03.json\n\n /*MISSING*/\n tests/sample_input.dirs/simple/file04.json\n\ninspiration:tools:0: hammer\n tests/sample_input.dirs/simple/file02.json\n\n /*MISSING*/\n tests/sample_input.dirs/simple/file01.json\n tests/sample_input.dirs/simple/file03.json\n tests/sample_input.dirs/simple/file04.json\n\ninspiration:tools:1: rack\n tests/sample_input.dirs/simple/file02.json\n\n /*MISSING*/\n tests/sample_input.dirs/simple/file01.json\n tests/sample_input.dirs/simple/file03.json\n tests/sample_input.dirs/simple/file04.json\n\nvegetable: spinach\n tests/sample_input.dirs/simple/file03.json\n\n /*MISSING*/\n tests/sample_input.dirs/simple/file01.json\n tests/sample_input.dirs/simple/file02.json\n tests/sample_input.dirs/simple/file04.json\n```\n## SAMPLE INPUT\n### file01.json\n```json\n{\n\"grain\": \"rice\",\n\"color\": \"red\",\n \"fruit\": \"apple\",\n \"inspiration\": {\"art\":\"Pablo Picasso\",\"music\":\"Dead Kennedys\"}\n}\n```\n### file02.json\n```json\n {\n \"color\": \"red\",\n \"fruit\": \"cherry\",\n \"inspiration\": {\"art\":\"Frida Kahlo\",\"music\":\"Dead Kennedys\",\"tools\":[\"hammer\",\"rack\"]}\n }\n```\n\n### file03.json\n```json\n {\n \"vegetable\": \"spinach\",\n \"color\": \"red\",\n \"fruit\": \"apple\",\n \"inspiration\": {\"art\":\"Pablo Picasso\",\"music\":\"Dead Kennedys\"}\n }\n```\n### file04.json\n```json\n{\n \"color\": \"red\"\n }\n```\n## REQUIREMENTS\n* pip\n* python >= 3.8\n\n## LICENSE\nGNU General Public License v3.0\n\n## SETUP\n```\npip3 install diffant\n```\n\n## USAGE\n```\ndiffant <directory with files of same type>\n```\n\n## BUGS\n1. The files you are comparing need to be at the top level of a directory that you supply as a positional argument to `diffant`\n1. The files need to have an extension that reflects their contents (ini,json.yml)\n1. You can't compare files of different types or have files of different types in your input directory.\n\n## SUPPORT\ndan@omacneil.org\n\n## CONTRIBUTORS\n* @morgan: Helpful tweak to README.md\n* [cpat-gpt](https://chat.openai.com/): about 50% of the code\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "tool to compare structured files like json, ini , yaml",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/omacneil/diffant",
"Repository": "https://github.com/omacneil/diffant"
},
"split_keywords": [
"json",
"yaml",
"ini",
"diff",
"configuration",
"compare"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "daddc2f7c925a099ff8266759d2bea087af9dc8d2e1a6d82f09fe284a3f28598",
"md5": "d0e0f09c03115d9aa921dc9c5de9f0d1",
"sha256": "827b2ee5ce9024a6d1f837d7cd27a70a54e1c72c0cbb43481df5b2e4317a5ef6"
},
"downloads": -1,
"filename": "diffant-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d0e0f09c03115d9aa921dc9c5de9f0d1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<4.0.0",
"size": 24501,
"upload_time": "2023-07-02T00:52:29",
"upload_time_iso_8601": "2023-07-02T00:52:29.280247Z",
"url": "https://files.pythonhosted.org/packages/da/dd/c2f7c925a099ff8266759d2bea087af9dc8d2e1a6d82f09fe284a3f28598/diffant-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cc5b2623eddbaf9b0ce6a16b1c7b77af1434f219aeab4c121e3756fd09b249b5",
"md5": "c21bc5ac81bba7a7146c0355eedd955c",
"sha256": "138abb248c80e6637700f9039f2e8d22b709a1b2aa1340ade756d74ec5318ff7"
},
"downloads": -1,
"filename": "diffant-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "c21bc5ac81bba7a7146c0355eedd955c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<4.0.0",
"size": 22352,
"upload_time": "2023-07-02T00:52:31",
"upload_time_iso_8601": "2023-07-02T00:52:31.102772Z",
"url": "https://files.pythonhosted.org/packages/cc/5b/2623eddbaf9b0ce6a16b1c7b77af1434f219aeab4c121e3756fd09b249b5/diffant-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-02 00:52:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "omacneil",
"github_project": "diffant",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"tox": true,
"lcname": "diffant"
}