Missing import in generated code when using well known types
まだ誰も着手していません。
評価
調査の方向性
まず foo.proto と、記載されている python -m grpc_tools.protoc コマンドで問題を再現し、次に生成された init.py を確認します。RPC の戻り値として google.protobuf.Empty を使用した場合の出力と比較します。このエッジケースの出力が、参照されているエイリアスで betterproto.lib.google.protobuf をインポートし、生成されたコードが正常にコンパイルできれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 235
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
danielgtaylor/python-betterproto のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
-
bug investigation needed
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
-
bug investigation needed
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
bug investigation needed
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
danielgtaylor/python-betterproto#676 · コメント 3 件 ·
danielgtaylor/python-betterproto の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
gramaziokohler/compas_timber#870 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
autowarefoundation/autoware_carla_scenario#500 ·
メンテナーはふだん 1 日以内に返信
-
good first issue priority: low size: XS testing
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
cubrid-lab/cubrid-mcp-server#385 ·
メンテナーはふだん 1 日以内に返信
-
good first issue priority: low size: S testing
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
cubrid-lab/cubrid-cookbook-python#447 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100