Closed benjamingorman closed 6 months ago
This is fixed on v2
For the outputs being missing you need to run Poe generate iirc or something to that effect
Ok, good to know.
I haven't found a way to be able to run v2 though. Is there something I can do to get more information out of this command so I can debug?
$ poetry run python -m grpc_tools.protoc -I . --python_betterproto_out=lib example.proto
--python_betterproto_out: protoc-gen-python_betterproto: Plugin failed with status code 1.
Summary
When a 'repeated string' type field in a protobuf object is used, and an empty string appended to it via the python-betterproto object, the empty string is not present in serialized output.
An empty string is a requirement in some protobuf definitions, for example Google pprof format which requires an empty string to be present at the beginning of the string table https://github.com/google/pprof/blob/main/proto/profile.proto
Reproduction Steps
Example code to reproduce:
example.proto
codegen run with
protoc -I . --python_betterproto_out=lib example.proto
main.py
example.b64:
CgNmb28=
This is with python-betterproto 1.2.5 I wanted to test on the latest version of betterproto however after cloning the repo and running
poetry install
I could not:I also wanted to try adding a test case for this to the repo however I cannot currently run the tests:
Any idea why the
tests.output_betterproto
module would be missing?Expected Results
The empty string appended should have appeared in the serialized protobuf.
Actual Results
The empty string is not present in the serialized protobuf.
System Information
libprotoc 26.1 Python 3.10.6 Name: betterproto Version: 1.2.5 Summary: A better Protobuf / gRPC generator & library Home-page: http://github.com/danielgtaylor/python-betterproto Author: Daniel G. Taylor Author-email: danielgtaylor@gmail.com License: MIT Location: c:\users\dude_\projects\proto-test.venv\lib\site-packages Requires: grpclib, stringcase Required-by:
Checklist
pip install -U --pre betterproto
, if possible.