Repository: feast-dev/feast

Issue:
protobuf pinned to <3.20.0
We pinned the version of protobuf to `protobuf>=3.10,<3.20` because we patch some functionality when converting json <> proto in the AWS Lambda feature server (https://github.com/feast-dev/feast/blob/master/sdk/python/feast/proto_json.py#L18).

protobuf 3.20.0 changes the API we patch - so the version bump needs to happen along with an update to the patched methods.

#2480 has more context.


Discussion:

Resolving patch:
diff --git a/sdk/python/feast/proto_json.py b/sdk/python/feast/proto_json.py
--- a/sdk/python/feast/proto_json.py
+++ b/sdk/python/feast/proto_json.py
@@ -70,7 +70,7 @@ def to_json_object(printer: _Printer, message: ProtoMessage) -> JsonObject:
         return value
 
     def from_json_object(
-        parser: _Parser, value: JsonObject, message: ProtoMessage,
+        parser: _Parser, value: JsonObject, message: ProtoMessage, path: str
     ) -> None:
         if value is None:
             message.null_val = 0
@@ -142,11 +142,11 @@ def to_json_object(printer: _Printer, message: ProtoMessage) -> JsonObject:
         return [printer._MessageToJsonObject(item) for item in message.val]
 
     def from_json_object(
-        parser: _Parser, value: JsonObject, message: ProtoMessage,
+        parser: _Parser, value: JsonObject, message: ProtoMessage, path: str
     ) -> None:
         array = value if isinstance(value, list) else value["val"]
         for item in array:
-            parser.ConvertMessage(item, message.val.add())
+            parser.ConvertMessage(item, message.val.add(), path)
 
     _patch_proto_json_encoding(RepeatedValue, to_json_object, from_json_object)
 
@@ -183,7 +183,7 @@ def to_json_object(printer: _Printer, message: ProtoMessage) -> JsonObject:
         return list(message.val)
 
     def from_json_object(
-        parser: _Parser, value: JsonObject, message: ProtoMessage,
+        parser: _Parser, value: JsonObject, message: ProtoMessage, path: str
     ) -> None:
         array = value if isinstance(value, list) else value["val"]
         message.val.extend(array)
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -52,15 +52,15 @@
     "fastavro>=1.1.0,<2",
     "google-api-core>=1.23.0,<3",
     "googleapis-common-protos>=1.52.*,<2",
-    "grpcio>=1.34.0,<2",
-    "grpcio-reflection>=1.34.0,<2",
+    "grpcio>=1.47.0,<2",
+    "grpcio-reflection>=1.47.0,<2",
     "Jinja2>=2,<4",
     "jsonschema",
     "mmh3",
     "numpy>=1.22,<2",
     "pandas>=1,<2",
     "pandavro==1.5.*",
-    "protobuf>=3.10,<3.20",
+    "protobuf>3.20,<4",
     "proto-plus==1.20.*",
     "pyarrow>=4,<7",
     "pydantic>=1,<2",
@@ -131,8 +131,8 @@
         "flake8",
         "black==19.10b0",
         "isort>=5,<6",
-        "grpcio-tools==1.44.0",
-        "grpcio-testing==1.44.0",
+        "grpcio-tools==1.47.0",
+        "grpcio-testing==1.47.0",
         "minio==7.1.0",
         "mock==2.0.0",
         "moto",
@@ -514,8 +514,8 @@ def copy_extensions_to_source(self):
     use_scm_version=use_scm_version,
     setup_requires=[
         "setuptools_scm",
-        "grpcio",
-        "grpcio-tools==1.44.0",
+        "grpcio==1.47.0",
+        "grpcio-tools==1.47.0",
         "mypy-protobuf==3.1",
         "pybindgen==0.22.0",
         "sphinx!=4.0.0",
@@ -533,4 +533,4 @@ def copy_extensions_to_source(self):
             ["github.com/feast-dev/feast/go/embedded"],
         )
     ],
-)
+)
\ No newline at end of file


Test patch:
diff --git a/sdk/python/tests/unit/test_proto_json.py b/sdk/python/tests/unit/test_proto_json.py
--- a/sdk/python/tests/unit/test_proto_json.py
+++ b/sdk/python/tests/unit/test_proto_json.py
@@ -81,7 +81,7 @@ def test_feast_repeated_value(proto_json_patch):
     # additional structure (e.g. [1,2,3] instead of {"val": [1,2,3]})
     repeated_value_str = "[1,2,3]"
     repeated_value_proto = RepeatedValue()
-    Parse(repeated_value_str, repeated_value_proto)
+    Parse(repeated_value_str, repeated_value_proto, "")
     assertpy.assert_that(len(repeated_value_proto.val)).is_equal_to(3)
     assertpy.assert_that(repeated_value_proto.val[0].int64_val).is_equal_to(1)
     assertpy.assert_that(repeated_value_proto.val[1].int64_val).is_equal_to(2)