A Python CLI tool that compares two data structures and creates human-friendly output
gendiff --help
usage: gendiff [-h] [-f FORMAT] first_file second_file
Generate diff
positional arguments:
first_file
second_file
optional arguments:
-h, --help show this help message and exit
-f FORMAT, --format FORMAT
set format of output
Codebase info:
In logic.py there is a decoding and comparison functionality.
In formatters.py there are functions to generate output from internal comparison data.
In gendiff.py there is "generate_diff" function, which creates data pipeline, connecting all the pieces together. Running this module as a script will provide CLI. In case you need a direct access, the whole functionality can easily be imported to your project with "generate_diff" as a library function.
Training project at hexlet.io.
Python3 • Pytest • Poetry • JSON • PyYAML • Argparse • Linux • Git • Github Actions (CI) • MyPy • Flake8 • CodeClimate • Make
- Working with complex data structures
- Parsing and formatting using Python
- Building an effective data pipeline with CLI
- Using recursive algorithms for tree traversal
- Testing and coding within short development cycle (TDD)
git clone https://github.com/siderai/gendiff
cd gendiff
make package-install
make test
gendiff --help
{
- follow: false
host: hexlet.io
- proxy: 123.234.53.22
- timeout: 50
+ timeout: 20
+ verbose: true
}
Property 'follow' was removed
Property 'proxy' was removed
Property 'timeout' was updated. From 50 to 20
Property 'verbose' was added with value: true
{" host": "hexlet.io", "- timeout": 50, "+ timeout": 20, "- follow": false, "- proxy": "123.234.53.22", "+ verbose": true}