Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: Remove mmh3 external dependency and use internal pymmh3 in place #362

Merged
merged 9 commits into from
Nov 3, 2021
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