DeepDiff

8.6.2 · active · verified Sat Mar 28

DeepDiff is a Python library designed for deep comparison and search operations across various Python objects and data structures, including dictionaries, lists, strings, and custom objects. It recursively identifies all differences, providing detailed reports. DeepDiff also supports hashing objects based on their content (DeepHash) and creating/applying 'deltas' to reconstruct objects. The current version is 8.6.2, and it maintains an active release cadence with frequent updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a basic comparison between two dictionaries using DeepDiff. It will output a dictionary detailing added items, removed items, and changed values between `t1` and `t2`.

from deepdiff import DeepDiff

t1 = {'name': 'Alice', 'age': 30, 'city': 'New York'}
t2 = {'name': 'Bob', 'age': 31, 'city': 'London', 'occupation': 'Engineer'}

diff = DeepDiff(t1, t2)
print(diff)

view raw JSON →