You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Buf uses 1.2.5 of betterproto package, which cannot process optional keywords
What is the feature request for?
The core library
The Problem
In our company we have a standard to use buf to generate bindings to proto files.
And we wanted to use betterproto plugin to generate idiomatic python code.
Unfortunately, the only version of the plugin (v1.2.5) doesn't support some "newer" protobuf features, like "optional" keyword.
This was fixed in v.2.0.0b4, but this release is not available in buf.
You're likely also going to need grpcio and grpcio-tools installed.
Then, in my custom generate script, I did this:
# Find all .proto files
proto_files=$(find /schemas/proto -name "*.proto")
# Special case for Python to use betterproto so that we can use Pydantic Dataclasses
python3 -m grpc_tools.protoc \
-I /schemas/proto \
--python_betterproto_out=/schemas/output/python/proto/ \
--python_betterproto_opt=pydantic_dataclasses,typing.310 \
$proto_files
Summary
Buf uses 1.2.5 of betterproto package, which cannot process
optional
keywordsWhat is the feature request for?
The core library
The Problem
In our company we have a standard to use buf to generate bindings to proto files.
And we wanted to use betterproto plugin to generate idiomatic python code.
Unfortunately, the only version of the plugin (v1.2.5) doesn't support some "newer" protobuf features, like "optional" keyword.
This was fixed in v.2.0.0b4, but this release is not available in buf.
The Ideal Solution
Can I ask to release latest beta (v.2.0.0b7 as the time of writing) as another version of community plugin?
https://github.com/danielgtaylor/python-betterproto/milestone/4 does not seem to be forthcoming.
Thanks
The Current Solution
Rely on official buf python plugin
https://buf.build/protocolbuffers/python?version=v28.0
The text was updated successfully, but these errors were encountered: