File tree Expand file tree Collapse file tree 5 files changed +45
-21
lines changed
providers/openfeature-provider-flagd
openfeature/contrib/provider/flagd/resolvers Expand file tree Collapse file tree 5 files changed +45
-21
lines changed Original file line number Diff line number Diff line change @@ -38,16 +38,14 @@ jobs:
3838 python-version : ${{ matrix.python-version }}
3939 cache : " pip"
4040
41- - uses : bufbuild/buf-action@v1
42- with :
43- github_token : ${{ github.token }}
44- setup_only : true
41+ - name : Install Hatch
42+ uses : pypa/hatch@install
4543
46- - name : Install hatch
47- run : pip install hatch
44+ - name : Building first to generate files
45+ run : hatch build
4846
4947 - name : Test with pytest
50- run : hatch run cov
48+ run : hatch test -c
5149 working-directory : ${{ matrix.package }}
5250
5351 - if : matrix.python-version == '3.11'
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ Homepage = "https://github.com/open-feature/python-sdk-contrib"
3232
3333[tool .hatch ]
3434
35- [tool .hatch .envs .default ]
35+ [tool .hatch .envs .hatch-test ]
3636dependencies = [
3737 " coverage[toml]>=6.5" ,
3838 " pytest" ,
@@ -41,28 +41,49 @@ dependencies = [
4141 " asserts" ,
4242 " grpcio-health-checking==1.60.0" ,
4343]
44+ pre-install-commands = [
45+ " hatch build" ,
46+ ]
4447
45- [tool .hatch .envs .default .scripts ]
46- test = " pytest {args:tests}"
47- test-cov = " coverage run -m pytest {args:tests}"
48+ [tool .hatch .envs .hatch-test .scripts ]
49+ run = " pytest {args:tests}"
50+ run-cov = " coverage run -m pytest {args:tests}"
51+ cov-combine = " coverage combine"
4852cov-report = [
4953 " coverage xml" ,
5054 " coverage html" ,
55+ " coverage report" ,
5156]
5257cov = [
5358 " test-cov" ,
5459 " cov-report" ,
5560]
5661
5762[tool .hatch .build .hooks .protobuf ]
58- dependencies = [" hatch-protobuf" ]
59- paths = [" schemas/protobuf/schema/v1/schema.proto" , " schemas/protobuf/sync/v1/sync_service.proto" ]
60- output_path = " src"
63+ generate_pyi = false
64+ dependencies = [
65+ " hatch-protobuf" ,
66+ " mypy-protobuf~=3.0" ,
67+ ]
68+ proto_paths = [
69+ " schemas/protobuf/" ,
70+ ]
71+ output_path = " src/"
72+
73+ [[tool .hatch .build .hooks .protobuf .generators ]]
74+ name = " mypy"
75+ outputs = [" {proto_path}/{proto_name}_pb2.pyi" ]
76+
77+ [[tool .hatch .build .hooks .protobuf .generators ]]
78+ name = " mypy_grpc"
79+ outputs = [" {proto_path}/{proto_name}_pb2_grpc.pyi" ]
6180
6281[tool .hatch .build .targets .sdist ]
6382exclude = [
6483 " .gitignore" ,
6584 " schemas" ,
85+ " src/schema" ,
86+ " src/sync" ,
6687]
6788
6889[tool .hatch .build .targets .wheel ]
Original file line number Diff line number Diff line change 1+ flagd
2+ schema
3+ sync
Original file line number Diff line number Diff line change 33import grpc
44from google .protobuf .json_format import MessageToDict
55from google .protobuf .struct_pb2 import Struct
6- from schemas .protobuf .flagd .evaluation .v1 import ( # type:ignore[import-not-found]
6+
7+ from flagd .evaluation .v1 import ( # type:ignore[import-not-found]
78 evaluation_pb2 ,
89 evaluation_pb2_grpc ,
910)
10-
1111from openfeature .evaluation_context import EvaluationContext
1212from openfeature .exception import (
1313 FlagNotFoundError ,
@@ -86,6 +86,13 @@ def _resolve( # noqa: PLR0915
8686 context = self ._convert_context (evaluation_context )
8787 call_args = {"timeout" : self .config .timeout }
8888 try :
89+ request : typing .Union [
90+ evaluation_pb2 .ResolveBooleanRequest ,
91+ evaluation_pb2 .ResolveIntRequest ,
92+ evaluation_pb2 .ResolveStringRequest ,
93+ evaluation_pb2 .ResolveObjectRequest ,
94+ evaluation_pb2 .ResolveFloatRequest ,
95+ ]
8996 if flag_type == FlagType .BOOLEAN :
9097 request = evaluation_pb2 .ResolveBooleanRequest (
9198 flag_key = flag_key , context = context
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments