Open eigenein opened 5 years ago
It'll be a good starting point to write the generator based on this project: https://github.com/dropbox/mypy-protobuf/blob/master/python/protoc-gen-mypy
The mypy style annotations in pyi files it generates are actually pretty close to your @dataclass
decorated message classes.
An off-topic suggestion BTW, since the package is called pure-protobuf
, it's better to name this git project the same.
Or generate *.proto files for others from the dataclasses?
Is it still relevant? My project would benefit from such functionality, so I might try to implement it.
@mbednarski I'd assume so. Feel free to submit a pull request anyway
dumb q - is there already code to do the reverse? *.py
-> *.proto
(for sharing outward?)
@EricCousineau-TRI no, there wasn't such a thing
For 3rd-party APIs people often have messages defined via
*.proto
files which are "ground truth". It requires additional work to keep Python data classes in sync with*.proto
. Let's a make a "code generator" which translates*.proto
files into*.py
modules