| 1 |
.. DeepDiff documentation master file, created by |
| 2 |
sphinx-quickstart on Mon Jul 20 06:06:44 2015. |
| 3 |
You can adapt this file completely to your liking, but it should at least |
| 4 |
contain the root `toctree` directive. |
| 5 |
|
| 6 |
|
| 7 |
DeepDiff 9.0.0 documentation! |
| 8 |
============================= |
| 9 |
|
| 10 |
.. |qluster_link| raw:: html |
| 11 |
|
| 12 |
<a href="/qluster"><strong>Qluster</strong></a> |
| 13 |
|
| 14 |
.. admonition:: DeepDiff is now part of |qluster_link|. |
| 15 |
|
| 16 |
*If you're building workflows around data validation and correction,* `Qluster </qluster>`__ *gives your team a structured way to manage rules, review failures, approve fixes, and reuse decisions—without building the entire system from scratch.* |
| 17 |
|
| 18 |
|
| 19 |
******* |
| 20 |
Modules |
| 21 |
******* |
| 22 |
|
| 23 |
The DeepDiff library includes the following modules: |
| 24 |
|
| 25 |
- **DeepDiff** For Deep Difference of 2 objects. :doc:`/diff` |
| 26 |
|
| 27 |
It returns the deep difference of python objects. It can also be used to take the distance between objects. :doc:`/deep_distance` |
| 28 |
|
| 29 |
- **DeepSearch** Search for objects within other objects. :doc:`/dsearch` |
| 30 |
|
| 31 |
- **DeepHash** Hash any object based on their content even if they are not "hashable" in Python's eyes. :doc:`/deephash` |
| 32 |
|
| 33 |
- **Delta** Delta of objects that can be applied to other objects. Imagine git commits but for structured data. :doc:`/delta` |
| 34 |
|
| 35 |
- **Extract** For extracting a path from an object :doc:`/extract` |
| 36 |
|
| 37 |
- **Commandline** Most of the above functionality is also available via the commandline module :doc:`/commandline` |
| 38 |
|
| 39 |
*********** |
| 40 |
What Is New |
| 41 |
*********** |
| 42 |
|
| 43 |
DeepDiff 9-0-0 |
| 44 |
-------------- |
| 45 |
|
| 46 |
- migration note: |
| 47 |
- `to_dict()` and `to_json()` now accept a `verbose_level` parameter and always return a usable text-view dict. When the original view is `'tree'`, they default to `verbose_level=2` for full detail. The old `view_override` parameter is removed. To get the previous results, you will need to pass the explicit verbose_level to `to_json` and `to_dict` if you are using the tree view. |
| 48 |
- Dropping support for Python 3.9 |
| 49 |
- Support for python 3.14 |
| 50 |
- Added support for callable ``group_by`` thanks to `echan5 <https://github.com/echan5>`__ |
| 51 |
- Added ``FlatDeltaDict`` TypedDict for ``to_flat_dicts`` return type |
| 52 |
- Fixed colored view display when all list items are removed thanks to `yannrouillard <https://github.com/yannrouillard>`__ |
| 53 |
- Fixed ``hasattr()`` swallowing ``AttributeError`` in ``__slots__`` handling for objects with ``__getattr__`` thanks to `tpvasconcelos <https://github.com/tpvasconcelos>`__ |
| 54 |
- Fixed ``ignore_order=True`` missing int-vs-float type changes |
| 55 |
- Always use t1 path for reporting thanks to `devin13cox <https://github.com/devin13cox>`__ |
| 56 |
- Fixed ``_convert_oversized_ints`` failing on NamedTuples |
| 57 |
- Fixed orjson ``TypeError`` for integers exceeding 64-bit range |
| 58 |
- Fixed parameter bug in ``to_flat_dicts`` where ``include_action_in_path`` and ``report_type_changes`` were not being passed through |
| 59 |
- Fixed ``ignore_keys`` issue in ``detailed__dict__`` thanks to `vitalis89 <https://github.com/vitalis89>`__ |
| 60 |
- Fixed logarithmic similarity type hint thanks to `ljames8 <https://github.com/ljames8>`__ |
| 61 |
- Added ``Fraction`` numeric support thanks to `akshat62 <https://github.com/akshat62>`__ |
| 62 |
|
| 63 |
********* |
| 64 |
Tutorials |
| 65 |
********* |
| 66 |
|
| 67 |
Tutorials can be found on `Zepworks blog <https://zepworks.com/tags/deepdiff/>`_ |
| 68 |
|
| 69 |
|
| 70 |
************ |
| 71 |
Installation |
| 72 |
************ |
| 73 |
|
| 74 |
Install from PyPi:: |
| 75 |
|
| 76 |
pip install deepdiff |
| 77 |
|
| 78 |
If you want to use DeepDiff from commandline:: |
| 79 |
|
| 80 |
pip install "deepdiff[cli]" |
| 81 |
|
| 82 |
If you want to improve the performance of DeepDiff with certain processes such as json serialization:: |
| 83 |
|
| 84 |
pip install "deepdiff[optimize]" |
| 85 |
|
| 86 |
Read about DeepDiff optimizations at :ref:`optimizations_label` |
| 87 |
|
| 88 |
Importing |
| 89 |
--------- |
| 90 |
|
| 91 |
.. code:: python |
| 92 |
|
| 93 |
>>> from deepdiff import DeepDiff # For Deep Difference of 2 objects |
| 94 |
>>> from deepdiff import grep, DeepSearch # For finding if item exists in an object |
| 95 |
>>> from deepdiff import DeepHash # For hashing objects based on their contents |
| 96 |
>>> from deepdiff import Delta # For creating delta of objects that can be applied later to other objects. |
| 97 |
>>> from deepdiff import extract # For extracting a path from an object |
| 98 |
|
| 99 |
|
| 100 |
.. note:: |
| 101 |
if you want to use DeepDiff via commandline, make sure to run:: |
| 102 |
|
| 103 |
pip install "deepdiff[cli]" |
| 104 |
|
| 105 |
Then you can access the commands via: |
| 106 |
|
| 107 |
- DeepDiff |
| 108 |
|
| 109 |
.. code:: bash |
| 110 |
|
| 111 |
$ deep diff --help |
| 112 |
|
| 113 |
- Delta |
| 114 |
|
| 115 |
.. code:: bash |
| 116 |
|
| 117 |
$ deep patch --help |
| 118 |
|
| 119 |
- grep |
| 120 |
|
| 121 |
.. code:: bash |
| 122 |
|
| 123 |
$ deep grep --help |
| 124 |
|
| 125 |
- extract |
| 126 |
|
| 127 |
.. code:: bash |
| 128 |
|
| 129 |
$ deep extract --help |
| 130 |
|
| 131 |
|
| 132 |
Supported data types |
| 133 |
-------------------- |
| 134 |
|
| 135 |
int, string, unicode, dictionary, list, tuple, set, frozenset, OrderedDict, NamedTuple, Numpy, custom objects and more! |
| 136 |
|
| 137 |
|
| 138 |
References |
| 139 |
========== |
| 140 |
|
| 141 |
.. toctree:: |
| 142 |
:maxdepth: 4 |
| 143 |
|
| 144 |
diff |
| 145 |
dsearch |
| 146 |
deephash |
| 147 |
delta |
| 148 |
extract |
| 149 |
colored_view |
| 150 |
commandline |
| 151 |
changelog |
| 152 |
authors |
| 153 |
faq |
| 154 |
support |
| 155 |
|
| 156 |
|
| 157 |
Indices and tables |
| 158 |
================== |
| 159 |
|
| 160 |
* :ref:`genindex` |
| 161 |
* :ref:`modindex` |
| 162 |
* :ref:`search` |