feat(gapic-generator): add pure-python package initialization and versioning codegen#17639
Draft
ohmayr wants to merge 1 commit into
Draft
feat(gapic-generator): add pure-python package initialization and versioning codegen#17639ohmayr wants to merge 1 commit into
ohmayr wants to merge 1 commit into
Conversation
2c39683 to
7cbcd5a
Compare
3e90e85 to
f18c5f5
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a template-free, pure-Python code generation engine (PurePythonEngine) and component generators (starting with PackageInitGenerator for gapic_version.py and py.typed files) to bypass Jinja rendering for migrated templates. Feedback on the changes points out an issue in PackageInitGenerator.generate_gapic_version where double curly braces in an f-string are escaped to single curly braces in the output, which breaks the Release Please inline annotation marker. Using quadruple curly braces is suggested to output literal double curly braces.
7cbcd5a to
c8a8ee9
Compare
f18c5f5 to
27d9ab3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces PackageInitGenerator and PurePythonEngine, migrating package initialization and versioning file generation (gapic_version.py and PEP 561 py.typed marker files) from Jinja templates (.j2) to pure-Python code generation. The PurePythonEngine acts as an incremental template-free dispatcher, routing migrated file types to pure Python while gracefully falling back to Jinja for un-migrated templates. This change eliminates Jinja rendering overhead for versioning files, includes 100% unit test coverage in tests/unit/codegen/test_package_init.py, and produces zero diff against Bazel golden integration tests.