【发布时间】:2021-12-30 10:45:35
【问题描述】:
我看到很多 Google Python SDK 代码使用 proto-plus library 将 protobuf 消息模式编写为 Python 类。我想知道是否有办法将此类转换为 proto 文件。
即。
import proto
class Composer(proto.Message):
given_name = proto.Field(proto.STRING, number=1)
family_name = proto.Field(proto.STRING, number=2)
class Song(proto.Message):
composer = proto.Field(Composer, number=1)
title = proto.Field(proto.STRING, number=2)
lyrics = proto.Field(proto.STRING, number=3)
year = proto.Field(proto.INT32, number=4)
并生成一个 proto 文件
【问题讨论】:
标签: python protocol-buffers proto google-cloud-sdk