protobuf
protobuf copied to clipboard
Python pyi files generation description
I have recently learned that Protobuf compiler (protoc) for Python is able to generate .pyi files, which are very helpful, as the standard .py files are not designed to be readable.
It took a significant effort to find this feature after searching for an easier way of dealing with generated python files / IDE support for them.
Would it be possible to add a description of this feature to the Python tutorial section? https://developers.google.com/protocol-buffers/docs/pythontutorial
I was trying to find the same. How and where did you find it? @k-wozniak
I was trying to find the same. How and where did you find it? @k-wozniak
Pure luck. My team and I were using protobuf with Python, and I just could not believe that this is the only option. At some point, I went through the release history and v3.20.0 describes the support and how to generate .pyi files.
Protoc is now able to generate python stubs (.pyi) with --pyi_out
Example:
protoc -I=..\InputDirectory --python_out=..\PythonPyOutputDirectory --pyi_out=..\PythonPyiOutputDirectory ..\CompilerInput\proto_to_build.proto
@rudradesai200 , I create a repo for this based on @k-wozniak 's code. Feel free to use it: https://github.com/airbots/grafana-mimir-python-client
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago.
@github-actions "a comment"
Thanks for the update to the issue. I'll keep this in my planned work.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago.
@github-actions "a comment" 🙄
I'm working on an update right now, @andreymal . Thanks for your patience, and for keeping the issue open!
https://github.com/protocolbuffers/protocolbuffers.github.io/pull/132 addresses this missing information. Thanks for your help in identifying and resolving this.