Skip to main content

A Python package to diff two dictionaries

Project description

pyDictDiff

Visit https://test.pypi.org/project/diffTool/

This is a dictionary diff package for python.

Installation

These instructions will get you a copy of the package up and running on your terminal for development and testing purposes.

To install, type:

pip install -i https://test.pypi.org/simple/ diffTool

Alternatively, to clone (with HTTPS):

git clone https://gitlab.com/anupamkrish/pydictdiff.git

or (with SSH):

git clone git@gitlab.com:anupamkrish/pydictdiff.git

Usage

Import the package

>>> from diffTool import Diff

Instantiate the class

>>> x = Diff(
        {
            "A": "B",
            "C": {
                "D": "E"
            }
        },
        {
            "A": "X",
            "C": {
                "D": "Y"
            }
        }
    )

Access the differences through variable 'diffs'

>>> x.diffs
[
  {
    "A": {
      "[-]": "B",
      "[+]": "X"
    }
  },
  {
    "C -> D": {
      "[-]": "E",
      "[+]": "Y"
    }
  }
]

Caveat(s):

  • Does not detect elements not present in 2nd dictionary.

Future work:

  • Resolve caveat
  • Support for arrays
  • Strict option i.e. checks for order
  • Return single dictionary
  • Improved speed for large dictionaries

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydictdiff-1.0.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydictdiff-1.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file pydictdiff-1.0.0.tar.gz.

File metadata

  • Download URL: pydictdiff-1.0.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pydictdiff-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d8235639c2572d854db575cef380a7be7a0f3f680ecec41e892dafc3f141c8dc
MD5 16faa63e967265cbc74c68e42911eb3e
BLAKE2b-256 b5290e71f8e1c6a54735f2e46c81adf17a59a17cb468ee064347435ac8424c24

See more details on using hashes here.

File details

Details for the file pydictdiff-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pydictdiff-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pydictdiff-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0e578817736bd59eaaebaaa20269588905df58103b7bd661238f67b668bed95
MD5 5f45c3d769884c42bc60a3b6aa80d5b6
BLAKE2b-256 32054655851b8dd14d4aad22ea5d8d96a6fd1c4acc76a6d1ee922c5a617fc3cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page