File tree Expand file tree Collapse file tree 5 files changed +44
-5
lines changed
providers/openfeature-provider-flagd
src/openfeature/contrib/provider/flagd/resolvers Expand file tree Collapse file tree 5 files changed +44
-5
lines changed Original file line number Diff line number Diff line change 4545 run : hatch build
4646 working-directory : ${{ matrix.package }}
4747
48+ - name : Type checking
49+ if : matrix.package == 'providers/openfeature-provider-flagd'
50+ working-directory : ${{ matrix.package }}
51+ run : hatch run mypy
52+
4853 - name : Test with pytest
4954 run : hatch test -c
5055 working-directory : ${{ matrix.package }}
Original file line number Diff line number Diff line change 2929 - mmh3
3030 - semver
3131 - panzi-json-logic
32- exclude : proto |tests
32+ exclude : providers/openfeature-provider-flagd |tests
Original file line number Diff line number Diff line change 11[mypy]
2- files = hooks,providers
2+ files = hooks,providers/openfeature-provider-ofrep
33exclude = proto|tests
44untyped_calls_exclude = flagd.proto
55
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ classifiers = [
1717]
1818keywords = []
1919dependencies = [
20- " openfeature-sdk>=0.4 .0" ,
20+ " openfeature-sdk>=0.6 .0" ,
2121 " grpcio>=1.60.0" ,
2222 " protobuf>=4.25.2" ,
2323 " mmh3>=4.1.0" ,
@@ -40,6 +40,9 @@ dependencies = [
4040 " testcontainers" ,
4141 " asserts" ,
4242 " grpcio-health-checking==1.60.0" ,
43+ " mypy[faster-cache]>=1.13.0" ,
44+ " types-protobuf" ,
45+ " types-pyyaml" ,
4346]
4447pre-install-commands = [
4548 " hatch build" ,
@@ -93,3 +96,30 @@ omit = [
9396 " src/openfeature/contrib/provider/flagd/proto/*" ,
9497 " tests/**" ,
9598]
99+
100+ [tool .mypy ]
101+ mypy_path = " src"
102+ files = " src"
103+ exclude = [
104+ " src/openfeature/contrib/provider/flagd/protobuf"
105+ ]
106+
107+ namespace_packages = true
108+ explicit_package_bases = true
109+ local_partial_types = true
110+ pretty = true
111+
112+ strict = true
113+ disallow_any_generics = false
114+
115+ [[tool .mypy .overrides ]]
116+ module = [
117+ " grpc"
118+ ]
119+ ignore_missing_imports = true
120+
121+ [[tool .mypy .overrides ]]
122+ module = [
123+ " openfeature.contrib.provider.flagd.protobuf.*"
124+ ]
125+ follow_imports = " silent"
Original file line number Diff line number Diff line change 2020
2121from ..config import Config
2222from ..flag_type import FlagType
23+ from ..protobuf .flagd .evaluation .v1 import evaluation_pb2 , evaluation_pb2_grpc
24+
25+ if typing .TYPE_CHECKING :
26+ from google .protobuf .message import Message
2327
2428T = typing .TypeVar ("T" )
2529
@@ -31,7 +35,7 @@ def __init__(self, config: Config):
3135 grpc .secure_channel if self .config .tls else grpc .insecure_channel
3236 )
3337 self .channel = channel_factory (f"{ self .config .host } :{ self .config .port } " )
34- self .stub = evaluation_pb2_grpc .ServiceStub (self .channel )
38+ self .stub = evaluation_pb2_grpc .ServiceStub (self .channel ) # type: ignore[no-untyped-call]
3539
3640 def shutdown (self ) -> None :
3741 self .channel .close ()
@@ -94,7 +98,7 @@ def _resolve( # noqa: PLR0915
9498 evaluation_pb2 .ResolveFloatRequest ,
9599 ]
96100 if flag_type == FlagType .BOOLEAN :
97- request = evaluation_pb2 .ResolveBooleanRequest (
101+ request : Message = evaluation_pb2 .ResolveBooleanRequest (
98102 flag_key = flag_key , context = context
99103 )
100104 response = self .stub .ResolveBoolean (request , ** call_args )
You can’t perform that action at this time.
0 commit comments