Skip to content

Commit a871180

Browse files
committed
Merge branch 'dev'
2 parents bf7d1c5 + 7f70159 commit a871180

File tree

7 files changed

+18
-79
lines changed

7 files changed

+18
-79
lines changed
File renamed without changes.

README.md

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ Tested on Python 3.6+ and PyPy3.
2727

2828
`pip install deepdiff`
2929

30-
DeepDiff prefers to use Murmur3 for hashing. However you have to manually install Murmur3 by running:
31-
32-
`pip install 'deepdiff[murmur]'`
33-
34-
Otherwise DeepDiff will be using SHA256 for hashing which is a cryptographic hash and is considerably slower.
35-
36-
If you are running into trouble installing Murmur3, please take a look at the [Troubleshoot](#troubleshoot) section.
37-
3830
### Importing
3931

4032
```python
@@ -399,23 +391,6 @@ And here is more info: <http://zepworks.com/blog/diff-it-to-digg-it/>
399391

400392
<http://deepdiff.readthedocs.io/en/latest/>
401393

402-
# Troubleshoot
403-
404-
## Murmur3
405-
406-
`Failed to build mmh3 when installing DeepDiff`
407-
408-
DeepDiff prefers to use Murmur3 for hashing. However you have to manually install murmur3 by running: `pip install mmh3`
409-
410-
On MacOS Mojave some user experience difficulty when installing Murmur3.
411-
412-
The problem can be solved by running:
413-
414-
`xcode-select --install`
415-
416-
And then running
417-
418-
`pip install mmh3`
419394

420395
# ChangeLog
421396

@@ -444,34 +419,4 @@ Thank you!
444419

445420
# Authors
446421

447-
Authors listed in the order of the contributions:
448-
449-
- [Sep Dehpour (Seperman)](http://www.zepworks.com)
450-
- [Victor Hahn Castell](http://hahncastell.de) for the tree view and major contributions:
451-
- [nfvs](https://github.com/nfvs) for Travis-CI setup script.
452-
- [brbsix](https://github.com/brbsix) for initial Py3 porting.
453-
- [WangFenjin](https://github.com/WangFenjin) for unicode support.
454-
- [timoilya](https://github.com/timoilya) for comparing list of sets when ignoring order.
455-
- [Bernhard10](https://github.com/Bernhard10) for significant digits comparison.
456-
- [b-jazz](https://github.com/b-jazz) for PEP257 cleanup, Standardize on full names, fixing line endings.
457-
- [finnhughes](https://github.com/finnhughes) for fixing __slots__
458-
- [moloney](https://github.com/moloney) for Unicode vs. Bytes default
459-
- [serv-inc](https://github.com/serv-inc) for adding help(deepdiff)
460-
- [movermeyer](https://github.com/movermeyer) for updating docs
461-
- [maxrothman](https://github.com/maxrothman) for search in inherited class attributes
462-
- [maxrothman](https://github.com/maxrothman) for search for types/objects
463-
- [MartyHub](https://github.com/MartyHub) for exclude regex paths
464-
- [sreecodeslayer](https://github.com/sreecodeslayer) for DeepSearch match_string
465-
- Brian Maissy [brianmaissy](https://github.com/) for weakref fix, enum tests
466-
- Bartosz Borowik [boba-2](https://github.com/boba-2) for Exclude types fix when ignoring order
467-
- Brian Maissy [brianmaissy](https://github.com/brianmaissy) for fixing classes which inherit from classes with slots didn't have all of their slots compared
468-
- Juan Soler [Soleronline](https://github.com/Soleronline) for adding ignore_type_number
469-
- [mthaddon](https://github.com/mthaddon) for adding timedelta diffing support
470-
- [Necrophagos](https://github.com/Necrophagos) for Hashing of the number 1 vs. True
471-
- [gaal-dev](https://github.com/gaal-dev) for adding exclude_obj_callback
472-
- Ivan Piskunov [van-ess0](https://github.com/van-ess0) for deprecation warning enhancement.
473-
- Michał Karaś [MKaras93](https://github.com/MKaras93) for the pretty view
474-
- Christian Kothe [chkothe](https://github.com/chkothe) for the basic support for diffing numpy arrays
475-
- [Timothy](https://github.com/timson) for truncate_datetime
476-
- [d0b3rm4n](https://github.com/d0b3rm4n) for bugfix to not apply format to non numbers.
477-
- [MyrikLD](https://github.com/MyrikLD) for Bug Fix NoneType in ignore type groups
422+
Please take a look at the [AUTHORS](AUTHORS.md) file.

deepdiff/deephash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
logger = logging.getLogger(__name__)
1515

1616
UNPROCESSED_KEY = 'unprocessed'
17-
MURMUR_SEED = 1203
1817

1918
RESERVED_DICT_KEYS = {UNPROCESSED_KEY}
2019
EMPTY_FROZENSET = frozenset()
@@ -47,6 +46,7 @@ def combine_hashes_lists(items, prefix):
4746
Combines lists of hashes into one hash
4847
This can be optimized in future.
4948
It needs to work with both murmur3 hashes (int) and sha256 (str)
49+
Although murmur3 is not used anymore.
5050
"""
5151
if isinstance(prefix, bytes):
5252
prefix = prefix.decode('utf-8')

docs/deephash_doc.rst

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ The main usage of DeepHash is to calculate the hash of otherwise unhashable obje
77
For example you can use DeepHash to calculate the hash of a set or a dictionary!
88

99
At the core of it, DeepHash is a deterministic serialization of your object into a string so it
10-
can be passed to a hash function. By default it uses Murmur 3 128 bit hash function which is a
11-
fast, non-cryptographic hashing function. You have the option to pass any another hashing function to be used instead.
12-
13-
If it can't find Murmur3 package (mmh3) installed, it uses Python's built-in SHA256 for hashing which is considerably slower than Murmur3. So it is advised that you install Murmur3 by running `pip install 'deepdiff[murmur]`
10+
can be passed to a hash function. By default it uses SHA256. You have the option to pass any another hashing function to be used instead.
1411

1512
**Import**
1613
>>> from deepdiff import DeepHash
@@ -39,20 +36,21 @@ exclude_obj_callback
3936
A function that takes the object and its path and returns a Boolean. If True is returned, the object is excluded from the results, otherwise it is included.
4037
This is to give the user a higher level of control than one can achieve via exclude_paths, exclude_regex_paths or other means.
4138

42-
hasher: function. default = DeepHash.murmur3_128bit
43-
hasher is the hashing function. The default is DeepHash.murmur3_128bit.
39+
hasher: function. default = DeepHash.sha256hex
40+
hasher is the hashing function. The default is DeepHash.sha256hex.
4441
But you can pass another hash function to it if you want.
4542
For example a cryptographic hash function or Python's builtin hash function.
4643
All it needs is a function that takes the input in string format and returns the hash.
4744

4845
You can use it by passing: hasher=hash for Python's builtin hash.
4946

50-
The following alternatives are already provided:
47+
The following alternative is already provided:
5148

52-
- hasher=DeepHash.murmur3_128bit
53-
- hasher=DeepHash.murmur3_64bit
5449
- hasher=DeepHash.sha1hex
5550

51+
Note that prior to DeepDiff 5.2, Murmur3 was the default hash function.
52+
But Murmur3 is removed from DeepDiff dependencies since then.
53+
5654
ignore_repetition: Boolean, default = True
5755
If repetitions in an iterable should cause the hash of iterable to be different.
5856
Note that the deepdiff diffing functionality lets this to be the default at all times.
@@ -165,10 +163,9 @@ But with DeepHash:
165163

166164
At first it might seem weird why DeepHash(obj)[obj] but remember that DeepHash(obj) is a dictionary of hashes of all other objects that obj contains too.
167165

168-
The result hash is 34150898645750099477987229399128149852 which is generated by
169-
Murmur 3 128bit hashing algorithm. If you prefer to use another hashing algorithm, you can pass it using the hasher parameter. Read more about Murmur3 here: https://en.wikipedia.org/wiki/MurmurHash
166+
The result hash is 34150898645750099477987229399128149852. If you prefer to use another hashing algorithm, you can pass it using the hasher parameter.
170167

171-
If you do a deep copy of obj, it should still give you the same hash:
168+
If you do a deep copy of the obj, it should still give you the same hash:
172169

173170
>>> from copy import deepcopy
174171
>>> obj2 = deepcopy(obj)

docs/diff_doc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ get_deep_distance: Boolean, default = False
5757
group_by: String, default=None
5858
:ref:`group_by_label` can be used when dealing with list of dictionaries to convert them to group them by value defined in group_by. The common use case is when reading data from a flat CSV and primary key is one of the columns in the CSV. We want to use the primary key to group the rows instead of CSV row number.
5959

60-
hasher: default = DeepHash.murmur3_128bit
61-
Hash function to be used. If you don't want Murmur3, you can use Python's built-in hash function
60+
hasher: default = DeepHash.sha256hex
61+
Hash function to be used. If you don't want SHA256, you can use your own hash function
6262
by passing hasher=hash. This is for advanced usage and normally you don't need to modify it.
6363

6464
ignore_order : Boolean, default=False

docs/index.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,7 @@ Install from PyPi::
4949

5050
pip install deepdiff
5151

52-
DeepDiff prefers to use Murmur3 for hashing. However you need to manually install Murmur3 by running::
53-
54-
pip install 'deepdiff[murmur]'
55-
56-
Otherwise DeepDiff will be using SHA256 for hashing which is a cryptographic hash and is considerably slower for hashing.
57-
However hashing is not usually the bottleneck when dealing with big objects. Read more about DeepDiff :ref:`optimizations_label`
58-
59-
If you are running into trouble installing Murmur3, please take a look at the :ref:`troubleshoot_label` section.
52+
Read about DeepDiff optimizations at :ref:`optimizations_label`
6053

6154

6255
Importing

docs/troubleshoot.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Troubleshoot
88
Murmur3 Installation
99
~~~~~~~~~~~~~~~~~~~~
1010

11+
NOTE: Murmur3 was removed from DeepDiff 5.2.0
12+
13+
If you are running into this issue, you are using an older version of DeepDiff.
14+
1115
`Failed to build mmh3 when installing DeepDiff`
1216

1317
DeepDiff prefers to use Murmur3 for hashing. However you have to manually install murmur3 by running: `pip install mmh3`

0 commit comments

Comments
 (0)