Skip to content

Commit

Permalink
enhancement: Remove mmh3 external dependency and use internal pymmh3 …
Browse files Browse the repository at this point in the history
…in place (#362)

Summary
-------
-  Removal of mmh3 external dependency and update imports to use internal pymmh3 instead

Testing
-------
- FSC

Issues
-------
- "OASIS-7995"
  • Loading branch information
The-inside-man authored Nov 3, 2021
1 parent 5420c7c commit a1e31eb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 1 addition & 4 deletions optimizely/bucketer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@

import math

try:
import mmh3
except ImportError:
from .lib import pymmh3 as mmh3
from .lib import pymmh3 as mmh3


MAX_TRAFFIC_VALUE = 10000
Expand Down
1 change: 0 additions & 1 deletion requirements/core.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
jsonschema==3.2.0
pyrsistent==0.16.0
mmh3==2.5.1
requests>=2.21
pyOpenSSL>=19.1.0
cryptography>=2.8.0
Expand Down
5 changes: 2 additions & 3 deletions tests/test_bucketing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
# limitations under the License.

import json
import mmh3
import mock
import random

from optimizely import bucketer
from optimizely import entities
from optimizely import logger
from optimizely import optimizely
from optimizely.lib import pymmh3
from optimizely.lib import pymmh3 as mmh3

from . import base

Expand Down Expand Up @@ -215,7 +214,7 @@ def test_hash_values(self):

for i in range(10):
random_value = str(random.random())
self.assertEqual(mmh3.hash(random_value), pymmh3.hash(random_value))
self.assertEqual(mmh3.hash(random_value), mmh3.hash(random_value))


class BucketerWithLoggingTest(base.BaseTest):
Expand Down

0 comments on commit a1e31eb

Please sign in to comment.