Missing import in generated code when using well known types
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện vấn đề với foo.proto và lệnh python -m grpc_tools.protoc được nêu, sau đó kiểm tra init.py được tạo. So sánh đầu ra khi google.protobuf.Empty được sử dụng làm giá trị trả về của RPC. Được coi là hoàn thành khi đầu ra của trường hợp biên import betterproto.lib.google.protobuf dưới alias được tham chiếu và mã được tạo biên dịch thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
When compiling a proto file which references well known types, protoc should generate the line import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf. This does not happen in the following edge case.
Reproduction Steps
Create a file foo.proto whith the following content
syntax = "proto3";
import "google/protobuf/empty.proto";
service foo {
rpc foo (google.protobuf.Empty) returns (MyEmpty);
}
message MyEmpty {}
and compile it by running python -m grpc_tools.protoc -I . --python_betterproto_out=lib foo.proto.
Expected Results
The generated file __init__.py references a module betterproto_lib_google_protobuf, so it should import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf.
Note that it actually would be imported if I had used google.protobuf.Empty as the return value of the RPC above.
Actual Results
The generated file __init__.py does not import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
System Information
libprotoc 25.0
Python 3.10.12
betterproto 2.0.0b6 (tested with released version and github master branch)
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.
- Ngôn ngữ chính
- Python
- Star
- 1.8k
- Fork
- 235
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của danielgtaylor/python-betterproto
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
-
bug investigation needed
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
-
bug investigation needed
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
bug investigation needed
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
danielgtaylor/python-betterproto#676 · 3 bình luận ·
Tất cả issue của danielgtaylor/python-betterproto
Issue tương tự
-
bug P2 rust
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
jscott3201/rusty-bacnet#2085 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
evarness-ai/iris-harness#401 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
sistemicorp/scripts#62 ·
-
area/mac help wanted needs-qa
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100