Skip to content

Commit f2028f5

Browse files
feat: Update python-sdk (#289)
* feat: Update python-sdk Signed-off-by: Konvalinka <[email protected]> * further updates Signed-off-by: Konvalinka <[email protected]> * adjust of dependency Signed-off-by: Konvalinka <[email protected]> --------- Signed-off-by: Konvalinka <[email protected]>
1 parent d89b5b8 commit f2028f5

File tree

11 files changed

+202
-165
lines changed

11 files changed

+202
-165
lines changed

providers/openfeature-provider-env-var/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "OpenFeature Python Environment Variable Provider"
55
readme = "README.md"
66
requires-python = ">=3.9"
77
dependencies = [
8-
"openfeature-sdk>=0.6.0",
8+
"openfeature-sdk>=0.8.2",
99
]
1010
authors = [{ name = "OpenFeature", email = "[email protected]" }]
1111

providers/openfeature-provider-env-var/src/openfeature/contrib/provider/envvar/provider.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from openfeature.evaluation_context import EvaluationContext
66
from openfeature.exception import FlagNotFoundError, ParseError
7-
from openfeature.flag_evaluation import FlagResolutionDetails, Reason
7+
from openfeature.flag_evaluation import FlagResolutionDetails, FlagValueType, Reason
88
from openfeature.provider import AbstractProvider, Metadata
99

1010

@@ -64,9 +64,13 @@ def resolve_float_details(
6464
def resolve_object_details(
6565
self,
6666
flag_key: str,
67-
default_value: typing.Union[dict, list],
67+
default_value: typing.Union[
68+
typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]
69+
],
6870
evaluation_context: typing.Optional[EvaluationContext] = None,
69-
) -> FlagResolutionDetails[typing.Union[dict, list]]:
71+
) -> FlagResolutionDetails[
72+
typing.Union[typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]]
73+
]:
7074
def parse(value: str) -> typing.Union[dict, list]:
7175
result = json.loads(value)
7276

providers/openfeature-provider-env-var/uv.lock

Lines changed: 140 additions & 140 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

providers/openfeature-provider-flagd/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ classifiers = [
1717
]
1818
keywords = []
1919
dependencies = [
20-
"openfeature-sdk>=0.6.0",
20+
"openfeature-sdk>=0.8.2",
2121
"grpcio>=1.68.1",
2222
"protobuf>=5.26.1",
2323
"mmh3>=4.1.0",

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/provider.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
from openfeature.evaluation_context import EvaluationContext
3030
from openfeature.event import ProviderEventDetails
31-
from openfeature.flag_evaluation import FlagResolutionDetails
31+
from openfeature.flag_evaluation import FlagResolutionDetails, FlagValueType
3232
from openfeature.hook import Hook
3333
from openfeature.provider import AbstractProvider
3434
from openfeature.provider.metadata import Metadata
@@ -199,9 +199,13 @@ def resolve_integer_details(
199199
def resolve_object_details(
200200
self,
201201
flag_key: str,
202-
default_value: typing.Union[dict, list],
202+
default_value: typing.Union[
203+
typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]
204+
],
203205
evaluation_context: typing.Optional[EvaluationContext] = None,
204-
) -> FlagResolutionDetails[typing.Union[dict, list]]:
206+
) -> FlagResolutionDetails[
207+
typing.Union[typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]]
208+
]:
205209
return self.resolver.resolve_object_details(
206210
flag_key, default_value, evaluation_context
207211
)

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/grpc.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
ProviderNotReadyError,
2222
TypeMismatchError,
2323
)
24-
from openfeature.flag_evaluation import FlagResolutionDetails, Reason
24+
from openfeature.flag_evaluation import FlagResolutionDetails, FlagValueType, Reason
2525
from openfeature.schemas.protobuf.flagd.evaluation.v1 import (
2626
evaluation_pb2,
2727
evaluation_pb2_grpc,
@@ -300,9 +300,13 @@ def resolve_integer_details(
300300
def resolve_object_details(
301301
self,
302302
key: str,
303-
default_value: typing.Union[dict, list],
303+
default_value: typing.Union[
304+
typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]
305+
],
304306
evaluation_context: typing.Optional[EvaluationContext] = None,
305-
) -> FlagResolutionDetails[typing.Union[dict, list]]:
307+
) -> FlagResolutionDetails[
308+
typing.Union[typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]]
309+
]:
306310
return self._resolve(key, FlagType.OBJECT, default_value, evaluation_context)
307311

308312
def _resolve( # noqa: PLR0915 C901
@@ -387,7 +391,7 @@ def _convert_context(
387391
if evaluation_context:
388392
try:
389393
s["targetingKey"] = evaluation_context.targeting_key
390-
s.update(evaluation_context.attributes)
394+
s.update(evaluation_context.attributes) # type: ignore[arg-type]
391395
except ValueError as exc:
392396
message = (
393397
"could not serialize evaluation context to google.protobuf.Struct"

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/in_process.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from openfeature.evaluation_context import EvaluationContext
77
from openfeature.event import ProviderEventDetails
88
from openfeature.exception import ErrorCode, FlagNotFoundError, GeneralError, ParseError
9-
from openfeature.flag_evaluation import FlagResolutionDetails, Reason
9+
from openfeature.flag_evaluation import FlagResolutionDetails, FlagValueType, Reason
1010

1111
from ..config import Config
1212
from .process.connector import FlagStateConnector
@@ -105,9 +105,13 @@ def resolve_integer_details(
105105
def resolve_object_details(
106106
self,
107107
key: str,
108-
default_value: typing.Union[dict, list],
108+
default_value: typing.Union[
109+
typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]
110+
],
109111
evaluation_context: typing.Optional[EvaluationContext] = None,
110-
) -> FlagResolutionDetails[typing.Union[dict, list]]:
112+
) -> FlagResolutionDetails[
113+
typing.Union[typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]]
114+
]:
111115
return self._resolve(key, default_value, evaluation_context)
112116

113117
def _resolve(

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/process/targeting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def targeting(
3232
raise ParseError(f"Invalid 'targeting' value in flag: {targeting}")
3333

3434
json_logic_context = evaluation_context.attributes if evaluation_context else {}
35-
json_logic_context["$flagd"] = {"flagKey": key, "timestamp": int(time.time())}
36-
json_logic_context["targetingKey"] = (
35+
json_logic_context["$flagd"] = {"flagKey": key, "timestamp": int(time.time())} # type: ignore[index]
36+
json_logic_context["targetingKey"] = ( # type: ignore[index]
3737
evaluation_context.targeting_key if evaluation_context else None
3838
)
3939
return jsonLogic(targeting, json_logic_context, OPERATORS)

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/protocol.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing_extensions import Protocol
44

55
from openfeature.evaluation_context import EvaluationContext
6-
from openfeature.flag_evaluation import FlagResolutionDetails
6+
from openfeature.flag_evaluation import FlagResolutionDetails, FlagValueType
77

88

99
class AbstractResolver(Protocol):
@@ -42,6 +42,10 @@ def resolve_integer_details(
4242
def resolve_object_details(
4343
self,
4444
key: str,
45-
default_value: typing.Union[dict, list],
45+
default_value: typing.Union[
46+
typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]
47+
],
4648
evaluation_context: typing.Optional[EvaluationContext] = None,
47-
) -> FlagResolutionDetails[typing.Union[dict, list]]: ...
49+
) -> FlagResolutionDetails[
50+
typing.Union[typing.Sequence[FlagValueType], typing.Mapping[str, FlagValueType]]
51+
]: ...

providers/openfeature-provider-ofrep/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ classifiers = [
1717
]
1818
keywords = []
1919
dependencies = [
20-
"openfeature-sdk>=0.7.0",
20+
"openfeature-sdk>=0.8.2",
2121
"requests>=2.27.0"
2222
]
2323
requires-python = ">=3.9"

0 commit comments

Comments
 (0)