danielgtaylor / danielgtaylor/python-betterproto
Add support for custom options
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 234
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Custom options are a vanilla proto feature documented here. I personally have a use case for them to apply constraints, similar to protoc-gen-validate. I think supporting generic custom options would be a great addition to python-betterproto.
In order for this to happen, I see a couple changes that would be needed:
- The options proto needs to be compiled by protoc and imported into the namespace from which
CodeGeneratorRequest. ParseFromStringis called. This req is documented in protocolbuffers/protobuf#3321. plugin.pyneeds the ability to parse the custom options and somehow store them.- We'd need to figure out how to use the custom options: Python has no concept of applying "options" (aside from comments). There are many mechanisms that could be employed (getters/setters, pydantic, comments, etc.). My feeling is that to cover all use cases,
plugin.pywould need to be made extendable so that individual implementations can decide how to parse custom options and how to use them in the generation of the output.pyfiles.
Is there any interest in this? I'd be willing to try and work on something.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
plugin.py と CodeGeneratorRequest.ParseFromString 周辺の options proto の読み込みから始め、次にリンクされている custom-options のドキュメントと protobuf issue を読んでください。生成される Python 出力のために、options をどのように解析、保存、公開すべきかを判断してください。文書化された使用可能な汎用メカニズムが実装され、テストでカバーされた時点で作業は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- compilers, tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100