openfeature-provider-flagd 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl
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.
- openfeature/contrib/provider/flagd/config.py +9 -0
- openfeature/contrib/provider/flagd/provider.py +2 -0
- openfeature/contrib/provider/flagd/resolvers/in_process.py +1 -1
- openfeature/contrib/provider/flagd/resolvers/process/connector/grpc_watcher.py +22 -9
- openfeature/contrib/provider/flagd/resolvers/process/flags.py +2 -4
- openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2_grpc.py +1 -1
- openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2_grpc.py +1 -1
- openfeature/schemas/protobuf/schema/v1/schema_pb2_grpc.py +1 -1
- openfeature/schemas/protobuf/sync/v1/sync_service_pb2_grpc.py +1 -1
- {openfeature_provider_flagd-0.2.1.dist-info → openfeature_provider_flagd-0.2.2.dist-info}/METADATA +1 -1
- {openfeature_provider_flagd-0.2.1.dist-info → openfeature_provider_flagd-0.2.2.dist-info}/RECORD +13 -13
- {openfeature_provider_flagd-0.2.1.dist-info → openfeature_provider_flagd-0.2.2.dist-info}/WHEEL +0 -0
- {openfeature_provider_flagd-0.2.1.dist-info → openfeature_provider_flagd-0.2.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -100,6 +100,7 @@ class Config:
|
|
|
100
100
|
cert_path: typing.Optional[str] = None,
|
|
101
101
|
default_authority: typing.Optional[str] = None,
|
|
102
102
|
channel_credentials: typing.Optional[grpc.ChannelCredentials] = None,
|
|
103
|
+
sync_metadata_disabled: typing.Optional[bool] = None,
|
|
103
104
|
):
|
|
104
105
|
self.host = env_or_default(ENV_VAR_HOST, DEFAULT_HOST) if host is None else host
|
|
105
106
|
|
|
@@ -248,3 +249,11 @@ class Config:
|
|
|
248
249
|
)
|
|
249
250
|
|
|
250
251
|
self.channel_credentials = channel_credentials
|
|
252
|
+
|
|
253
|
+
# TODO: remove the metadata call entirely after https://github.com/open-feature/flagd/issues/1584
|
|
254
|
+
# This is a temporary stop-gap solutions to support servers that don't implement sync.GetMetadata
|
|
255
|
+
# (see: https://buf.build/open-feature/flagd/docs/main:flagd.sync.v1#flagd.sync.v1.FlagSyncService.GetMetadata).
|
|
256
|
+
# Using this option disables call to sync.GetMetadata
|
|
257
|
+
# Disabling will prevent static context from flagd being used in evaluations.
|
|
258
|
+
# GetMetadata and this option will be removed.
|
|
259
|
+
self.sync_metadata_disabled = sync_metadata_disabled
|
|
@@ -64,6 +64,7 @@ class FlagdProvider(AbstractProvider):
|
|
|
64
64
|
cert_path: typing.Optional[str] = None,
|
|
65
65
|
default_authority: typing.Optional[str] = None,
|
|
66
66
|
channel_credentials: typing.Optional[grpc.ChannelCredentials] = None,
|
|
67
|
+
sync_metadata_disabled: typing.Optional[bool] = None,
|
|
67
68
|
):
|
|
68
69
|
"""
|
|
69
70
|
Create an instance of the FlagdProvider
|
|
@@ -106,6 +107,7 @@ class FlagdProvider(AbstractProvider):
|
|
|
106
107
|
cert_path=cert_path,
|
|
107
108
|
default_authority=default_authority,
|
|
108
109
|
channel_credentials=channel_credentials,
|
|
110
|
+
sync_metadata_disabled=sync_metadata_disabled,
|
|
109
111
|
)
|
|
110
112
|
self.enriched_context: dict = {}
|
|
111
113
|
|
|
@@ -6,6 +6,7 @@ import typing
|
|
|
6
6
|
|
|
7
7
|
import grpc
|
|
8
8
|
from google.protobuf.json_format import MessageToDict
|
|
9
|
+
from google.protobuf.struct_pb2 import Struct
|
|
9
10
|
|
|
10
11
|
from openfeature.evaluation_context import EvaluationContext
|
|
11
12
|
from openfeature.event import ProviderEventDetails
|
|
@@ -162,24 +163,36 @@ class GrpcWatcher(FlagStateConnector):
|
|
|
162
163
|
self.active = False
|
|
163
164
|
self.channel.close()
|
|
164
165
|
|
|
166
|
+
def _create_request_args(self) -> dict:
|
|
167
|
+
request_args = {}
|
|
168
|
+
if self.selector is not None:
|
|
169
|
+
request_args["selector"] = self.selector
|
|
170
|
+
if self.provider_id is not None:
|
|
171
|
+
request_args["provider_id"] = self.provider_id
|
|
172
|
+
|
|
173
|
+
return request_args
|
|
174
|
+
|
|
165
175
|
def listen(self) -> None:
|
|
166
176
|
call_args = (
|
|
167
177
|
{"timeout": self.streamline_deadline_seconds}
|
|
168
178
|
if self.streamline_deadline_seconds > 0
|
|
169
179
|
else {}
|
|
170
180
|
)
|
|
171
|
-
request_args =
|
|
172
|
-
if self.selector is not None:
|
|
173
|
-
request_args["selector"] = self.selector
|
|
174
|
-
if self.provider_id is not None:
|
|
175
|
-
request_args["provider_id"] = self.provider_id
|
|
181
|
+
request_args = self._create_request_args()
|
|
176
182
|
|
|
177
183
|
while self.active:
|
|
178
184
|
try:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
context_values_response: sync_pb2.GetMetadataResponse
|
|
186
|
+
if self.config.sync_metadata_disabled:
|
|
187
|
+
context_values_response = sync_pb2.GetMetadataResponse(
|
|
188
|
+
metadata=Struct()
|
|
189
|
+
)
|
|
190
|
+
else:
|
|
191
|
+
context_values_request = sync_pb2.GetMetadataRequest()
|
|
192
|
+
context_values_response = self.stub.GetMetadata(
|
|
193
|
+
context_values_request, wait_for_ready=True
|
|
194
|
+
)
|
|
195
|
+
|
|
183
196
|
context_values = MessageToDict(context_values_response)
|
|
184
197
|
|
|
185
198
|
request = sync_pb2.SyncFlagsRequest(**request_args)
|
|
@@ -72,10 +72,8 @@ class Flag:
|
|
|
72
72
|
data["default_variant"] = data["defaultVariant"]
|
|
73
73
|
del data["defaultVariant"]
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if "selector" in data:
|
|
78
|
-
del data["selector"]
|
|
75
|
+
data.pop("source", None)
|
|
76
|
+
data.pop("selector", None)
|
|
79
77
|
try:
|
|
80
78
|
flag = cls(key=key, **data)
|
|
81
79
|
return flag
|
|
@@ -5,7 +5,7 @@ import warnings
|
|
|
5
5
|
|
|
6
6
|
from openfeature.schemas.protobuf.flagd.evaluation.v1 import evaluation_pb2 as openfeature_dot_schemas_dot_protobuf_dot_flagd_dot_evaluation_dot_v1_dot_evaluation__pb2
|
|
7
7
|
|
|
8
|
-
GRPC_GENERATED_VERSION = '1.
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.71.0'
|
|
9
9
|
GRPC_VERSION = grpc.__version__
|
|
10
10
|
_version_not_supported = False
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ import warnings
|
|
|
5
5
|
|
|
6
6
|
from openfeature.schemas.protobuf.flagd.sync.v1 import sync_pb2 as openfeature_dot_schemas_dot_protobuf_dot_flagd_dot_sync_dot_v1_dot_sync__pb2
|
|
7
7
|
|
|
8
|
-
GRPC_GENERATED_VERSION = '1.
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.71.0'
|
|
9
9
|
GRPC_VERSION = grpc.__version__
|
|
10
10
|
_version_not_supported = False
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ import warnings
|
|
|
5
5
|
|
|
6
6
|
from openfeature.schemas.protobuf.schema.v1 import schema_pb2 as openfeature_dot_schemas_dot_protobuf_dot_schema_dot_v1_dot_schema__pb2
|
|
7
7
|
|
|
8
|
-
GRPC_GENERATED_VERSION = '1.
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.71.0'
|
|
9
9
|
GRPC_VERSION = grpc.__version__
|
|
10
10
|
_version_not_supported = False
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ import warnings
|
|
|
5
5
|
|
|
6
6
|
from openfeature.schemas.protobuf.sync.v1 import sync_service_pb2 as openfeature_dot_schemas_dot_protobuf_dot_sync_dot_v1_dot_sync__service__pb2
|
|
7
7
|
|
|
8
|
-
GRPC_GENERATED_VERSION = '1.
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.71.0'
|
|
9
9
|
GRPC_VERSION = grpc.__version__
|
|
10
10
|
_version_not_supported = False
|
|
11
11
|
|
{openfeature_provider_flagd-0.2.1.dist-info → openfeature_provider_flagd-0.2.2.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openfeature-provider-flagd
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: OpenFeature provider for the flagd flag evaluation engine
|
|
5
5
|
Project-URL: Homepage, https://github.com/open-feature/python-sdk-contrib
|
|
6
6
|
Author-email: OpenFeature <openfeature-core@groups.io>
|
{openfeature_provider_flagd-0.2.1.dist-info → openfeature_provider_flagd-0.2.2.dist-info}/RECORD
RENAMED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
openfeature/.gitignore,sha256=1ZPH4VtVL4bMQmBJXQJxeAyUa74LCtqV1a_yjeDIzSQ,8
|
|
2
2
|
openfeature/contrib/provider/flagd/__init__.py,sha256=WlrcPaCH31dEG1IvrvpeuhAaQ8Ni8LEzDpNM_x-qKOA,65
|
|
3
|
-
openfeature/contrib/provider/flagd/config.py,sha256=
|
|
3
|
+
openfeature/contrib/provider/flagd/config.py,sha256=GAt8skBFMzF4skf8l8yr7jl7KBUM509ogZDpvF3NByk,8380
|
|
4
4
|
openfeature/contrib/provider/flagd/flag_type.py,sha256=rZYfmqQEmtqVVTb8e-d8Wt8ZCnHtf7xPSmYxyU8w0R0,158
|
|
5
|
-
openfeature/contrib/provider/flagd/provider.py,sha256=
|
|
5
|
+
openfeature/contrib/provider/flagd/provider.py,sha256=wJGCFdfZlk6Y-ABU3PNSiKvrlQlNMZavsdrR2QlTqJY,7931
|
|
6
6
|
openfeature/contrib/provider/flagd/sync_metadata_hook.py,sha256=fd3uRtwDhVlCW9vZhS35p9qENkl6wDHwlFH-L48aPDM,456
|
|
7
7
|
openfeature/contrib/provider/flagd/resolvers/__init__.py,sha256=CzsnsfxJCaD_S1gBf15kkJBVD-gVLKIwDi4W1nE-dXw,181
|
|
8
8
|
openfeature/contrib/provider/flagd/resolvers/grpc.py,sha256=KJTrwZM-XF2-Xw-O4YvrN-Xvn_KqsO9T29lBAjiDS-4,13581
|
|
9
|
-
openfeature/contrib/provider/flagd/resolvers/in_process.py,sha256=
|
|
9
|
+
openfeature/contrib/provider/flagd/resolvers/in_process.py,sha256=Ce42cagr521rW6zW_LjT1yeVYeVqBJrNM6ASlYbdn2c,4628
|
|
10
10
|
openfeature/contrib/provider/flagd/resolvers/protocol.py,sha256=Wc7oUH6ytPuKg8Lj_3y-_LLkQkuvsow9IiSfmlM8I2o,1402
|
|
11
11
|
openfeature/contrib/provider/flagd/resolvers/process/custom_ops.py,sha256=bZX1At0dRxhghhWz4g-8N-YPobcVfYSv9PTsYh-lZDc,4549
|
|
12
|
-
openfeature/contrib/provider/flagd/resolvers/process/flags.py,sha256=
|
|
12
|
+
openfeature/contrib/provider/flagd/resolvers/process/flags.py,sha256=jEU-8xjGm-NXPfB6O4no4Zn8XjGTFPGRkdXx-t8uQp0,3199
|
|
13
13
|
openfeature/contrib/provider/flagd/resolvers/process/targeting.py,sha256=qjYgfoJK9B1ghh19cUq7f-VEql7Hh1J7sh0BhnNc_h0,905
|
|
14
14
|
openfeature/contrib/provider/flagd/resolvers/process/connector/__init__.py,sha256=hyYYxRYEnSho5F28M2hbhhtkG4DQTwJjD36ddI0Xs7M,289
|
|
15
15
|
openfeature/contrib/provider/flagd/resolvers/process/connector/file_watcher.py,sha256=f4jg9tHj94R_PJ4sCZ2f6B1r7Fgm1NqEZr68qH9pYYk,3920
|
|
16
|
-
openfeature/contrib/provider/flagd/resolvers/process/connector/grpc_watcher.py,sha256=
|
|
16
|
+
openfeature/contrib/provider/flagd/resolvers/process/connector/grpc_watcher.py,sha256=XwG71pZqLLEBn7FAT0BhrO1LcCTuEwNZAXvEr37gioY,8835
|
|
17
17
|
openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2.py,sha256=YPBimdlVBCfnVqxq9uek3H4nyaIR0MhggCAaR0XtIt4,7527
|
|
18
18
|
openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2.pyi,sha256=afh-fdsmyfS62C-iq7EQsqr_5yZP_QxJXp81Q0Lcllk,18333
|
|
19
|
-
openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2_grpc.py,sha256=
|
|
19
|
+
openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2_grpc.py,sha256=owH7bBrwEdzXxvabwv1ebzWVczshLFE3TZcDoAj8Owk,17189
|
|
20
20
|
openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2_grpc.pyi,sha256=tQm-QOlsMdhdN_7i5LsrtLtBPu4qpL0qzTE7DbSvXFs,7731
|
|
21
21
|
openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2.py,sha256=OIhVrNkhXtwuCdvbahXiOx-mQ3XVVPx5gh0UHzKN0_M,3528
|
|
22
22
|
openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2.pyi,sha256=Qsqe0vz5AJRAAjARXhjiaPKyIFbLttr4gTWae2zyJfM,5967
|
|
23
|
-
openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2_grpc.py,sha256=
|
|
23
|
+
openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2_grpc.py,sha256=gwoXi82VHekdHGuMGvFC0VbNpqVW8tnX2EkkxVDpvzU,8335
|
|
24
24
|
openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2_grpc.pyi,sha256=APjDd-Yo6i6FE_kOusWhTqk-8B_0wIEMXcImCuGpQt8,3782
|
|
25
25
|
openfeature/schemas/protobuf/schema/v1/schema_pb2.py,sha256=dfGpiAYJ2VuRBrctH7s21KkdrIr9rzIaWibUZ3So3g4,7255
|
|
26
26
|
openfeature/schemas/protobuf/schema/v1/schema_pb2.pyi,sha256=14Z6i0kRpCAQO8aCpc4Qwre1OJ7_d_ZIPq8V1vTuYzU,18369
|
|
27
|
-
openfeature/schemas/protobuf/schema/v1/schema_pb2_grpc.py,sha256=
|
|
27
|
+
openfeature/schemas/protobuf/schema/v1/schema_pb2_grpc.py,sha256=af2955mIP2jB9LXZqnfN9cpQbPhl0tTg86MsQzsiy60,16227
|
|
28
28
|
openfeature/schemas/protobuf/schema/v1/schema_pb2_grpc.pyi,sha256=EJ55jvso2Uzx50XryC7fsKGEOBi1bMOGCXaShl1TcJ4,7067
|
|
29
29
|
openfeature/schemas/protobuf/sync/v1/sync_service_pb2.py,sha256=Sw0kLvO0wIRXsaFic8qmTuScMdf1-1WOHGWP4FOIB_s,3327
|
|
30
30
|
openfeature/schemas/protobuf/sync/v1/sync_service_pb2.pyi,sha256=o3YpW_5iQJWjU7IFEsyspeqLyBDC4C_psBNErwziumE,7986
|
|
31
|
-
openfeature/schemas/protobuf/sync/v1/sync_service_pb2_grpc.py,sha256=
|
|
31
|
+
openfeature/schemas/protobuf/sync/v1/sync_service_pb2_grpc.py,sha256=Fnkq2H0sfLwc029RXfFxp5__f4UskT6Hbn_ZBT0LpJU,6185
|
|
32
32
|
openfeature/schemas/protobuf/sync/v1/sync_service_pb2_grpc.pyi,sha256=4NoAkGicVNxx4yVK5_JvvPn1OGlRdPhqM2wCpkwCjEI,3024
|
|
33
|
-
openfeature_provider_flagd-0.2.
|
|
34
|
-
openfeature_provider_flagd-0.2.
|
|
35
|
-
openfeature_provider_flagd-0.2.
|
|
36
|
-
openfeature_provider_flagd-0.2.
|
|
33
|
+
openfeature_provider_flagd-0.2.2.dist-info/METADATA,sha256=-rYNDdWa7IAGVC23b4mx0BbpQdujHKRcHgm7iOi90BA,21635
|
|
34
|
+
openfeature_provider_flagd-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
35
|
+
openfeature_provider_flagd-0.2.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
36
|
+
openfeature_provider_flagd-0.2.2.dist-info/RECORD,,
|
{openfeature_provider_flagd-0.2.1.dist-info → openfeature_provider_flagd-0.2.2.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|