danielgtaylor / danielgtaylor/python-betterproto
Generated class name change proto casing
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
Given the following protobuf:
```
message ABCAnswerDeleted {
uint64 test_id = 1;
}
```
Version: `betterproto[compiler]` -> `2.0.0b2` or `2.0.0b3` gives
```
@dataclass(eq=False, repr=False)
class AbcAnswerDeleted(betterproto.Message):
test_id: int = betterproto.uint64_field(1)
def __post_init__(self) -> None:
super().__post_init__()
```
Version: `betterproto[compiler]` -> `1.2.5` gives
```
@dataclass
class ABCAnswerDeleted(betterproto.Message):
test_id: int = betterproto.uint64_field(1)
```
In `2.0.0b2` classname `ABC` is turned into `Abc`. Is this something new to betterproto 2 ? Is there an option to specify to allow class-name conservation ?
Thanks for the lib and for the support :)
Seems to be coming from: https://github.com/danielgtaylor/python-betterproto/blob/v2.0.0b3/src/betterproto/compile/importing.py#L60
https://github.com/danielgtaylor/python-betterproto/blob/v2.0.0b3/src/betterproto/plugin/models.py#L302
Contributor guide
Research direction
Reproduce the generated output from the protobuf example, then inspect src/betterproto/compile/importing.py around line 60 and src/betterproto/plugin/models.py around line 302. Compare the class-name transformation with version 1.2.5; done means the handling of ABC is resolved or an explicit preservation option is supported and the generated name is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100