Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script to regenerate proto code + pyi stubs #823

Merged
merged 17 commits into from
Jun 22, 2020

Conversation

aabmass
Copy link
Member

@aabmass aabmass commented Jun 12, 2020

Closes #792, closes #793

  • Added a script scripts/proto_codegen.sh to regenerate the python code from proto files in the opentelemetry-proto repo. It does a fresh pull (or clone if needed) each time you build so just run the script to get updates from the other repo. Let me know if the script should be in a different place.
  • Generate .pyi stub files. This gives type hints for the strange code the protoc generates so tooling and mypy can make sense of it.
  • Added .gitattributes pattern for the generated code so you don't have to scroll through it (unless you want to 😄 )
  • Updated MANIFEST.in so it will pull in the pyi files.

@aabmass aabmass requested a review from a team as a code owner June 12, 2020 19:59
Copy link
Member

@toumorokoshi toumorokoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

scripts/proto_codegen.sh Show resolved Hide resolved
scripts/proto_codegen.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, it looks like the protos were regenerated as part of the change, if so it would be good to updated the changelog for it.

@aabmass
Copy link
Member Author

aabmass commented Jun 17, 2020

@ocelotl, any thoughts since you did #728?

Copy link
Contributor

@ocelotl ocelotl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great, it would be great to merge this into the tox directive for opentelemetry-proto.

scripts/proto_codegen.sh Show resolved Hide resolved
@ocelotl ocelotl self-requested a review June 17, 2020 22:51
As discussed in the SIG meeting, added a const
PROTO_REPO_BRANCH_OR_COMMIT, a commit/branch/tag in opentelemetry-proto
repo to build from. When you are ready to pull in changes from upstream
proto defs, just update the const, rebuild, and fix errors in OTLP
exporter.
@aabmass
Copy link
Member Author

aabmass commented Jun 22, 2020

As discussed in the SIG meeting, added a const PROTO_REPO_BRANCH_OR_COMMIT, a commit/branch/tag in opentelemetry-proto repo to build from. When you are ready to pull in changes from upstream proto defs, just update the const, rebuild, and fix errors in OTLP exporter or anywhere else the generated code is used.

@aabmass
Copy link
Member Author

aabmass commented Jun 22, 2020

Change looks good, it looks like the protos were regenerated as part of the change, if so it would be good to updated the changelog for it.

@codeboten changelog updated

@lzchen lzchen merged commit 9e20f74 into open-telemetry:master Jun 22, 2020
@aabmass aabmass deleted the proto-script-792 branch June 22, 2020 18:26
cnnradams pushed a commit to cnnradams/opentelemetry-python that referenced this pull request Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate pyi stubs from proto files Add script to regenerate proto files
5 participants