Skip to content

Commit 3d6ae92

Browse files
committed
Adding grep. Bumping version to 3.2.0
1 parent 5ae448b commit 3d6ae92

File tree

6 files changed

+336
-304
lines changed

6 files changed

+336
-304
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# deepdiff v 3.1.3
1+
# deepdiff v 3.2.0
22

33
<!-- ![Downloads](https://img.shields.io/pypi/dm/deepdiff.svg?style=flat) -->
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+
157159
DeepDiff comes with a utility to find the path to the item you are looking for.
158160
It is called DeepSearch and it has a similar interface to DeepDiff.
159161

@@ -175,6 +177,33 @@ Which will print:
175177

176178
Tip: 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)

README.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**DeepDiff v 3.1.3**
1+
**DeepDiff v 3.2.0**
22

33
Deep Difference of dictionaries, iterables, strings and other objects. It will recursively look for all the changes.
44

@@ -240,6 +240,7 @@ http://zepworks.com/blog/diff-it-to-digg-it/
240240

241241
**Changelog**
242242

243+
- v3-2-0: Adding grep for search: object | grep(item)
243244
- v3-1-3: Unicode vs. Bytes default fix
244245
- v3-1-2: NotPresent Fix when item is added or removed.
245246
- v3-1-1: Bug fix when item value is None (#58)

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
# built documents.
6161
#
6262
# The short X.Y version.
63-
version = '3.1.3'
63+
version = '3.2.0'
6464
# The full version, including alpha/beta/rc tags.
65-
release = '3.1.3'
65+
release = '3.2.0'
6666

6767
# The language for content autogenerated by Sphinx. Refer to documentation
6868
# for a list of supported languages.

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
DeepDiff 3.1.3 documentation!
6+
DeepDiff 3.2.0 documentation!
77
=============================
88

99
**DeepDiff: Deep Difference of dictionaries, iterables and almost any other object recursively.**
@@ -346,6 +346,7 @@ Indices and tables
346346
Changelog
347347
=========
348348

349+
- v3-2-0: Adding grep for search: object | grep(item)
349350
- v3-1-3: Unicode vs. Bytes default fix
350351
- v3-1-2: NotPresent Fix when item is added or removed.
351352
- v3-1-1: Bug fix when item value is None (#58)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
long_description = "Deep Difference and Search of any Python object/data."
1414

1515
setup(name='deepdiff',
16-
version='3.1.3',
16+
version='3.2.0',
1717
description='Deep Difference and Search of any Python object/data.',
1818
url='https://github.com/seperman/deepdiff',
1919
download_url='https://github.com/seperman/deepdiff/tarball/master',

0 commit comments

Comments
 (0)