danielgtaylor / danielgtaylor/python-betterproto
Make generated stubs import already existing stubs from another project
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 234
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I currently have a project defining some common message types called `common_proto` and it is installed using git with pip into another project as a package.
Inside the package, the proto files are found inside the `proto` folder and are imported inside my other proto file where I wanna use them like `import "common_proto/proto/common.proto"`. I have added my `site_packages` folder to `--proto_path` and generting everything works fine.
While the normal protobuf compiler for python correctly takes that proto and the already generated protobuf python when it imports it, betterproto generates the python files instead of using the ones available in the same folder which are available as `common_proto/proto/csm/common/__init__.py` where the package path is the one defined in `common.proto` like `package csm.common`.
I know this is probably not the most elegant setup for the folder structure, but it was the one we used with the old protobuf compiler.
Would it be possible for the betterproto compiler to look in the same folder with the proto file to search for the python module if it exists? Would help avoid regenerating the files and allow shipping proto files in other modules to be reused.
コントリビューションガイド
調査の方向性
`common_proto/proto/common.proto`、インポートする proto、`--proto_path`、および既存の `common_proto/proto/csm/common/__init__.py` で説明されているパッケージレイアウトを再現します。まず、インポートされた proto がどのように解決されるかを追跡し、次に既存の生成済み Python モジュールが再生成されずに再利用されること、そして 2 つのプロジェクト間でも import が引き続き機能することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100