danielgtaylor / python-betterproto

Clean, modern, Python 3.6+ code generator & library for Protobuf 3 and async gRPC
MIT License
1.56k stars 218 forks source link

Generate code using the API. #638

Closed LL-Ling closed 4 weeks ago

LL-Ling commented 4 weeks ago

Summary

I want to use the API to generate code instead of generating it through a plugin

What is the feature request for?

The core library

The Problem

Currently, I see that betterproto only offers a plugin-based generation method. data = b"" request = CodeGeneratorRequest() request.parse(data) I have read the source code and need to construct the byte stream data for data, which is very difficult for me. Could you provide a simpler method for generating code using the API?

The Ideal Solution

such: output = generate_code_with_proto(proto_file: Path)

The Current Solution

No response

Gobot1234 commented 4 weeks ago

This is fixed by #165

LL-Ling commented 4 weeks ago

This is fixed by #165

Thank you very much; using protobuf_parser has solved my problem very well.