-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid code generated when package name contains uppercase letter #562
Invalid code generated when package name contains uppercase letter #562
Comments
I have got the same issue. I'm running the generation on Linux with betterproto |
The problem lies in the regex expression for splitting the source type into a tuple: python-betterproto/src/betterproto/compile/importing.py Lines 29 to 42 in 1f88b67
However, your package naming should probably follow the style guide, which suggests using all lowercase letters. Adhering to this guideline would prevent this issue from occurring in the first place. |
See #437 |
Summary
Title
Reproduction Steps
This protofile works:
This doesn't:
With the latter, betterproto compiles to this:
The
from .. import PEmpty
is invalid import as nothing exists in the parent package.Command used:
python3 -m grpc_tools.protoc --proto_path=./proto/ --python_betterproto_out=./proto/ proto/*.proto
Python environment (output of
pip freeze
):Expected Results
Correct code generated
Actual Results
Incorrect code generated
System Information
libprotoc 3.12.4
Python 3.11.0rc1
Name: betterproto
Version: 2.0.0b6
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:
Requires: grpclib, python-dateutil, typing-extensions
Required-by:
Checklist
pip install -U --pre betterproto
, if possible.The text was updated successfully, but these errors were encountered: