Skip to content

Commit a1e31eb

Browse files
enhancement: Remove mmh3 external dependency and use internal pymmh3 in place (#362)
Summary ------- - Removal of mmh3 external dependency and update imports to use internal pymmh3 instead Testing ------- - FSC Issues ------- - "OASIS-7995"
1 parent 5420c7c commit a1e31eb

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

optimizely/bucketer.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313

1414
import math
1515

16-
try:
17-
import mmh3
18-
except ImportError:
19-
from .lib import pymmh3 as mmh3
16+
from .lib import pymmh3 as mmh3
2017

2118

2219
MAX_TRAFFIC_VALUE = 10000

requirements/core.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
jsonschema==3.2.0
22
pyrsistent==0.16.0
3-
mmh3==2.5.1
43
requests>=2.21
54
pyOpenSSL>=19.1.0
65
cryptography>=2.8.0

tests/test_bucketing.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
# limitations under the License.
1313

1414
import json
15-
import mmh3
1615
import mock
1716
import random
1817

1918
from optimizely import bucketer
2019
from optimizely import entities
2120
from optimizely import logger
2221
from optimizely import optimizely
23-
from optimizely.lib import pymmh3
22+
from optimizely.lib import pymmh3 as mmh3
2423

2524
from . import base
2625

@@ -215,7 +214,7 @@ def test_hash_values(self):
215214

216215
for i in range(10):
217216
random_value = str(random.random())
218-
self.assertEqual(mmh3.hash(random_value), pymmh3.hash(random_value))
217+
self.assertEqual(mmh3.hash(random_value), mmh3.hash(random_value))
219218

220219

221220
class BucketerWithLoggingTest(base.BaseTest):

0 commit comments

Comments
 (0)