We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
importlib.metadata.version
1 parent 6bc92af commit 1e22fc3Copy full SHA for 1e22fc3
tensorboard/plugin_util.py
@@ -201,7 +201,14 @@ def proto_to_json(proto):
201
Args:
202
proto: The proto to convert to JSON.
203
"""
204
- current_version = metadata.version("protobuf")
+ # Fallback for internal usage, since non third-party code doesn't really
205
+ # have the concept of "versions" in a monorepo. The package version chosen
206
+ # below is the minimum value to choose the non-deprecated kwarg to
207
+ # `MessageToJson`.
208
+ try:
209
+ current_version = metadata.version("protobuf")
210
+ except metadata.PackageNotFoundError:
211
+ current_version = "5.0.0"
212
if version.parse(current_version) >= version.parse("5.0.0"):
213
return json_format.MessageToJson(
214
proto,
0 commit comments