-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] Support for feature properties
Upgrades urllib3 and adds in support for feature properties.
- Loading branch information
Showing
16 changed files
with
89 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
= CHANGELOG | ||
|
||
==== 1.1.0 | ||
|
||
- updated to support feature properties | ||
- updated to rev the dependencies. Minimum support of Python 3.7 means | ||
upgrading the urllib to 2.x and SSE client library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#!/bin/sh | ||
docker build --no-cache -t featurehub/python-example:1.0 . | ||
#docker build --no-cache -t featurehub/python-example:1.0 . | ||
docker build -t featurehub/python-example:1.0 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
edge_url = 'https://zjbisc.demo.featurehub.io' | ||
edge_url = 'http://zjbisc.demo.featurehub.io' | ||
client_eval_key = 'default/9b71f803-da79-4c04-8081-e5c0176dda87/CtVlmUHirgPd9Qz92Y0IQauUMUv3Wb*4dacoo47oYp6hSFFjVkG' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
kind load docker-image featurehub/python-example:1.0 --name featurehub-cluster | ||
#featurehub-cluster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Flask[async]==2.0.3 | ||
flask-cors==3.0.10 | ||
#git+https://github.com/featurehub-io/featurehub-python-sdk@main#egg=featurehub-sdk | ||
git+https://github.com/featurehub-io/featurehub-python-sdk@feature/sdk-extensions#egg=featurehub-sdk | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import json | ||
from unittest import TestCase | ||
|
||
from unittest.mock import MagicMock | ||
|
||
from featurehub_sdk.fh_state_base_holder import FeatureStateHolder | ||
|
||
from featurehub_sdk.client_context import InternalFeatureRepository | ||
|
||
|
||
class FeaturePropertiesTest(TestCase): | ||
repo: InternalFeatureRepository | ||
|
||
def setUp(self) -> None: | ||
self.repo = MagicMock() | ||
|
||
def test_feature_returns_empty_with_no_feature_state(self): | ||
fs = FeatureStateHolder('key', self.repo) | ||
|
||
self.assertEqual(fs.feature_properties, {}) | ||
|
||
def test_feature_returns_empty_dict_with_no_value_in_feature_state(self): | ||
fs = FeatureStateHolder('key', self.repo) | ||
data = '''{ | ||
"id": "227dc2e8-59e8-424a-b510-328ef52010f7", | ||
"key": "key", | ||
"l": true, | ||
"version": 28, | ||
"type": "STRING", | ||
"value": "orange" | ||
}''' | ||
json_data = json.loads(data) | ||
fs.set_feature_state(json_data) | ||
|
||
self.assertEqual(fs.feature_properties, {}) | ||
|
||
def test_feature_returns_dict_when_properties_are_present(self): | ||
fs = FeatureStateHolder('key', self.repo) | ||
data = '''{ | ||
"id": "227dc2e8-59e8-424a-b510-328ef52010f7", | ||
"key": "key", | ||
"l": true, | ||
"version": 28, | ||
"type": "STRING", | ||
"value": "orange", | ||
"fp": {"category": "shoes", "appName": "conga", "portfolio": "fish"} | ||
}''' | ||
json_data = json.loads(data) | ||
fs.set_feature_state(json_data) | ||
|
||
self.assertEqual(fs.feature_properties, {"category": "shoes", "appName": "conga", "portfolio": "fish"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sdk_version="1.0.0" | ||
sdk_version="1.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
urllib3==1.26.* | ||
sseclient-py==1.7.* | ||
urllib3==2.2.* | ||
sseclient-py==1.8.* | ||
murmurhash2==0.2.* | ||
node_semver==0.8.* | ||
|
||
node_semver==0.9.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters