gofeatureflag-python-provider 0.4.0__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: gofeatureflag-python-provider
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: GO Feature Flag provider for OpenFeature
5
5
  License: Apache-2.0
6
6
  Keywords: feature flags,feature toggles,go-feature-flag,gofeatureflag,openfeature,open-feature
@@ -1,12 +1,19 @@
1
1
  import json
2
- from http import HTTPStatus
3
- from threading import Thread
4
- from typing import List, Optional, Type, Union
5
- from urllib.parse import urljoin
6
-
7
2
  import pylru
8
3
  import urllib3
9
4
  import websocket
5
+ from gofeatureflag_python_provider.data_collector_hook import DataCollectorHook
6
+ from gofeatureflag_python_provider.metadata import GoFeatureFlagMetadata
7
+ from gofeatureflag_python_provider.options import BaseModel, GoFeatureFlagOptions
8
+ from gofeatureflag_python_provider.request_flag_evaluation import (
9
+ RequestFlagEvaluation,
10
+ convert_evaluation_context,
11
+ )
12
+ from gofeatureflag_python_provider.response_flag_evaluation import (
13
+ JsonType,
14
+ ResponseFlagEvaluation,
15
+ )
16
+ from http import HTTPStatus
10
17
  from openfeature.evaluation_context import EvaluationContext
11
18
  from openfeature.exception import (
12
19
  ErrorCode,
@@ -17,21 +24,11 @@ from openfeature.exception import (
17
24
  )
18
25
  from openfeature.flag_evaluation import FlagResolutionDetails, Reason
19
26
  from openfeature.hook import Hook
20
- from openfeature.provider.metadata import Metadata
21
27
  from openfeature.provider import AbstractProvider
28
+ from openfeature.provider.metadata import Metadata
22
29
  from pydantic import PrivateAttr, ValidationError
23
-
24
- from gofeatureflag_python_provider.data_collector_hook import DataCollectorHook
25
- from gofeatureflag_python_provider.metadata import GoFeatureFlagMetadata
26
- from gofeatureflag_python_provider.options import BaseModel, GoFeatureFlagOptions
27
- from gofeatureflag_python_provider.request_flag_evaluation import (
28
- RequestFlagEvaluation,
29
- convert_evaluation_context,
30
- )
31
- from gofeatureflag_python_provider.response_flag_evaluation import (
32
- JsonType,
33
- ResponseFlagEvaluation,
34
- )
30
+ from threading import Thread
31
+ from typing import List, Optional, Type, Union
35
32
 
36
33
  AbstractProviderMetaclass = type(AbstractProvider)
37
34
  BaseModelMetaclass = type(BaseModel)
@@ -196,6 +193,16 @@ class GoFeatureFlagProvider(BaseModel, AbstractProvider, metaclass=CombinedMetac
196
193
  "/v1/feature/{}/eval".format(flag_key),
197
194
  )
198
195
 
196
+ # add exporter metadata to the context if it exists
197
+ if self.options.exporter_metadata:
198
+ goff_request.gofeatureflag["exporterMetadata"] = (
199
+ self.options.exporter_metadata
200
+ )
201
+ goff_request.gofeatureflag["exporterMetadata"]["openfeature"] = True
202
+ goff_request.gofeatureflag["exporterMetadata"][
203
+ "provider"
204
+ ] = "python"
205
+
199
206
  response = self._http_client.request(
200
207
  method="POST",
201
208
  url=url,
@@ -1,15 +1,13 @@
1
1
  import hashlib
2
2
  import json
3
- from typing import Optional, Any
4
-
3
+ from gofeatureflag_python_provider.options import BaseModel
5
4
  from openfeature.evaluation_context import EvaluationContext
6
5
  from openfeature.exception import (
7
6
  TargetingKeyMissingError,
8
7
  InvalidContextError,
9
8
  )
10
9
  from pydantic import SkipValidation
11
-
12
- from gofeatureflag_python_provider.options import BaseModel
10
+ from typing import Optional, Any, Dict
13
11
 
14
12
 
15
13
  class GoFeatureFlagEvaluationContext(BaseModel):
@@ -56,3 +54,4 @@ def convert_evaluation_context(
56
54
  class RequestFlagEvaluation(BaseModel):
57
55
  user: GoFeatureFlagEvaluationContext
58
56
  defaultValue: SkipValidation[Any] = None
57
+ gofeatureflag: Optional[Dict] = {}
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "gofeatureflag-python-provider"
3
- version = "0.4.0"
3
+ version = "0.4.1"
4
4
  description = "GO Feature Flag provider for OpenFeature"
5
5
  license = "Apache-2.0"
6
6
  authors = [ "Thomas Poignant" ]
@@ -38,7 +38,7 @@ classifiers = [
38
38
 
39
39
  [tool.poetry.group.dev.dependencies]
40
40
  pytest = ">=7.4,<9.0"
41
- black = ">=23.10.1,<25.0.0"
41
+ black = ">=23.10.1,<26.0.0"
42
42
  requests = "^2.31.0"
43
43
  pyyaml = "^6.0.1"
44
44
  pytest-docker = ">=2.0.1,<4.0.0"