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
2.0.0b7 breaks enums with underscores in field names
Reproduction Steps
Test proto definition, in test.proto:
syntax="proto3";
packagehello;
// Greeting represents a message you can tell a user.messageGreeting {
Riskrisk=1;
}
enumRisk {
LOW_RISK=0;
HIGH_RISK=1;
}
# Generated by the protocol buffer compiler. DO NOT EDIT!# sources: test.proto# plugin: python-betterproto# This file has been @generatedfromdataclassesimportdataclassimportbetterprotoclassRisk(betterproto.Enum):
LOW_RISK=0HIGH_RISK=1@dataclass(eq=False, repr=False)classGreeting(betterproto.Message):
"""Greeting represents a message you can tell a user."""risk: "Risk"=betterproto.enum_field(1)
Actual Results
2.0.0b7 output (lib/hello/__init__.py):
# Generated by the protocol buffer compiler. DO NOT EDIT!# sources: test.proto# plugin: python-betterproto# This file has been @generatedfromdataclassesimportdataclassimportbetterprotoclassRisk(betterproto.Enum):
_=0_=1@dataclass(eq=False, repr=False)classGreeting(betterproto.Message):
"""Greeting represents a message you can tell a user."""risk: "Risk"=betterproto.enum_field(1)
System Information
Protoc version: libprotoc 27.3
Python version: Python 3.11.7
Betterproto version:
Name: betterproto
Version: 2.0.0b7
Summary: A better Protobuf / gRPC generator & library
Home-page: https://github.com/danielgtaylor/python-betterproto
Author: Daniel G. Taylor
Author-email: [email protected]
License: MIT
Location: /Users/connor/Code/tests/test070/.venv/lib/python3.11/site-packages
Requires: grpclib, python-dateutil, typing-extensions
Required-by:
Checklist
I have searched the issues for duplicates.
I have shown the entire traceback, if possible.
I have verified this issue occurs on the latest prelease of betterproto which can be installed using pip install -U --pre betterproto, if possible.
The text was updated successfully, but these errors were encountered:
Summary
2.0.0b7 breaks enums with underscores in field names
Reproduction Steps
Test proto definition, in
test.proto
:Protoc compiler invocation:
$ protoc -I . --python_betterproto_out=lib test.proto
Expected Results
2.0.0b6 output (
lib/hello/__init__.py
):Actual Results
2.0.0b7 output (
lib/hello/__init__.py
):System Information
Checklist
pip install -U --pre betterproto
, if possible.The text was updated successfully, but these errors were encountered: