|
1 | 1 | import uuid
|
2 | 2 | from typing import Any, Callable, Type
|
3 | 3 |
|
4 |
| -import pkg_resources |
5 | 4 | from google.protobuf.json_format import ( # type: ignore
|
6 | 5 | _WKTJSONMETHODS,
|
7 | 6 | ParseError,
|
8 | 7 | _Parser,
|
9 | 8 | _Printer,
|
10 | 9 | )
|
| 10 | +from importlib_metadata import version as importlib_version |
11 | 11 | from packaging import version
|
12 | 12 |
|
13 | 13 | from feast.protos.feast.serving.ServingService_pb2 import FeatureList
|
@@ -118,7 +118,7 @@ def from_json_object_updated(
|
118 | 118 |
|
119 | 119 | # https://github.com/feast-dev/feast/issues/2484 Certain feast users need a higher version of protobuf but the
|
120 | 120 | # parameters of `from_json_object` changes in feast 3.20.1. This change gives users flexibility to use earlier versions.
|
121 |
| - current_version = pkg_resources.get_distribution("protobuf").version |
| 121 | + current_version = importlib_version("protobuf") |
122 | 122 | if version.parse(current_version) < version.parse("3.20"):
|
123 | 123 | _patch_proto_json_encoding(Value, to_json_object, from_json_object)
|
124 | 124 | else:
|
@@ -168,7 +168,7 @@ def from_json_object(
|
168 | 168 |
|
169 | 169 | # https://github.com/feast-dev/feast/issues/2484 Certain feast users need a higher version of protobuf but the
|
170 | 170 | # parameters of `from_json_object` changes in feast 3.20.1. This change gives users flexibility to use earlier versions.
|
171 |
| - current_version = pkg_resources.get_distribution("protobuf").version |
| 171 | + current_version = importlib_version("protobuf") |
172 | 172 | if version.parse(current_version) < version.parse("3.20"):
|
173 | 173 | _patch_proto_json_encoding(RepeatedValue, to_json_object, from_json_object)
|
174 | 174 | else:
|
@@ -221,7 +221,7 @@ def from_json_object_updated(
|
221 | 221 |
|
222 | 222 | # https://github.com/feast-dev/feast/issues/2484 Certain feast users need a higher version of protobuf but the
|
223 | 223 | # parameters of `from_json_object` changes in feast 3.20.1. This change gives users flexibility to use earlier versions.
|
224 |
| - current_version = pkg_resources.get_distribution("protobuf").version |
| 224 | + current_version = importlib_version("protobuf") |
225 | 225 | if version.parse(current_version) < version.parse("3.20"):
|
226 | 226 | _patch_proto_json_encoding(FeatureList, to_json_object, from_json_object)
|
227 | 227 | else:
|
|
0 commit comments