Skip to main content

Viewer tools for the `DeepDiff` object of the `deepdiff` library.

Project description

DeepDiff Viewer

A simple utility to visualize DeepDiff in the terminal. Support rich for even prettier renders.

Install

pip install deepdiff_viewer

To use the RichViewer class:

pip install deepdiff_viewer[rich]

Usage

Simple usage:

from deepdiff import DeepDiff
from deepdiff_viewer.rich import RichViewer

t1 = {"a": 1}
t2 = {"a": 3}

ddiff = DeepDiff(t1, t2, view="tree")
viewer = RichViewer(ddiff)
print(viewer.render())

Pydantic support

If you use pydantic for your models, the RichViewer will use the model_dump function to render the model in a yaml format when you add or delete new object. Otherwise the render would show you the python class and not a pretty render of the object.

Note that pydantic is not a dependency of the project but will be imported if it is found.

Examples

See the examples/ folder.

Simple

simple

Complex

complex

With Pydantic

with_pydantic

Concepts

The DeepDiffTreeViewer class wraps a DeepDiff object that was built with the tree view mode. It generates a tree of all the differences found in the DeepDiff object so that it can be rendered.

Currently the only implemented viewer is the RichViewer but you can extend the DeepDiffTreeViewer base class to make your own viewer if you want to use something else than rich.

License

MIT

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

deepdiff_viewer-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

deepdiff_viewer-0.1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file deepdiff_viewer-0.1.1.tar.gz.

File metadata

  • Download URL: deepdiff_viewer-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.12 Linux/6.1.38

File hashes

Hashes for deepdiff_viewer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 eb4fb90ba5d113cb6df43d8f970557441a8a79c61f81a7f23f259bc1c5f73127
MD5 0223cf9cbb91cd7140e7426119b136cf
BLAKE2b-256 f2115e065bbf9c62e60a7dfaaf65efc6817dc6517024548eb7fc0f4bc8b2257b

See more details on using hashes here.

File details

Details for the file deepdiff_viewer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: deepdiff_viewer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.12 Linux/6.1.38

File hashes

Hashes for deepdiff_viewer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2f97340d8321b7f11afbe6a54e19f6a723e1973b81b10947ad4252582c669ef
MD5 8cb8fae5afcbb8ab8b2783976d7085cc
BLAKE2b-256 eb0dd58a92e3a0da9e363d0ed46cf7babda39795dc3a8c0ecfd0756662d675fa

See more details on using hashes here.

Supported by

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