Skip to content

Script to regenerate proto code + pyi stubs#823

Merged
lzchen merged 17 commits intoopen-telemetry:masterfrom
aabmass:proto-script-792
Jun 22, 2020
Merged

Script to regenerate proto code + pyi stubs#823
lzchen merged 17 commits intoopen-telemetry:masterfrom
aabmass:proto-script-792

Conversation

@aabmass
Copy link
Copy Markdown
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 June 12, 2020 19:59
Copy link
Copy Markdown
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!

Copy link
Copy Markdown
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
Copy Markdown
Member Author

aabmass commented Jun 17, 2020

@ocelotl, any thoughts since you did #728?

Copy link
Copy Markdown
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.

@ocelotl ocelotl self-requested a review June 17, 2020 22:51
aabmass added 4 commits June 17, 2020 23:00
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
Copy Markdown
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
Copy Markdown
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