1- # deepdiff v 3.1.3
1+ # deepdiff v 3.2.0
22
33<!--  -->
44![ Python Versions] ( https://img.shields.io/pypi/pyversions/deepdiff.svg?style=flat )
@@ -154,6 +154,8 @@ Verbose level by default is 1. The possible values are 0, 1 and 2.
154154## Deep Search
155155(New in v2-1-0)
156156
157+ Tip: Take a look at [ grep] ( #grep ) which gives you a new interface for DeepSearch!
158+
157159DeepDiff comes with a utility to find the path to the item you are looking for.
158160It is called DeepSearch and it has a similar interface to DeepDiff.
159161
@@ -175,6 +177,33 @@ Which will print:
175177
176178Tip: An interesting use case is to search inside ` locals() ` when doing pdb.
177179
180+ ## Grep
181+ (New in v3-2-0)
182+
183+ Grep is another interface for DeepSearch.
184+ Just grep through your objects as you would in shell!
185+
186+ ``` py
187+ from deepdiff import grep
188+ obj = {" long" : " somewhere" , " string" : 2 , 0 : 0 , " somewhere" : " around" }
189+ ds = obj | grep(item)
190+ print (ds)
191+ ```
192+
193+ Which will print:
194+
195+ ``` py
196+ {' matched_paths' : {" root['somewhere']" },
197+ ' matched_values' : {" root['long']" }}
198+ ```
199+
200+ And you can pass all the same kwargs as DeepSearch to grep too:
201+
202+ ``` py
203+ >> > obj | grep(item, verbose_level = 2 )
204+ {' matched_paths' : {" root['somewhere']" : ' around' }, ' matched_values' : {" root['long']" : ' somewhere' }}
205+ ```
206+
178207## Using DeepDiff in unit tests
179208
180209` result ` is the output of the function that is being tests.
@@ -764,6 +793,7 @@ And here is more info: <http://zepworks.com/blog/diff-it-to-digg-it/>
764793
765794# #Changelog
766795
796+ - v3- 2 - 0 : Adding grep for search: object | grep(item)
767797- v3- 1 - 3 : Unicode vs. Bytes default fix
768798- v3- 1 - 2 : NotPresent Fix when item is added or removed.
769799- v3- 1 - 1 : Bug fix when item value is None (# 58)
0 commit comments