This repository was archived by the owner on Mar 26, 2026. It is now read-only.
feat: add gapic-version generator option#2440
Merged
Conversation
Contributor
Author
|
Needs fix from #2441 |
ohmayr
approved these changes
Sep 24, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
By allowing
gapic_version.pyfiles to include a specified version at time of generation, we will be able to reduce unnecessary diff when generating libraries. As an example, say the last release ofgoogle-cloud-libraryhad version1.2.99when we run the python GAPIC generator the version will be reset to0.0.0or0.1.0since it is hard coded in the files belowhttps://github.com/googleapis/gapic-generator-python/blob/main/gapic/templates/%25namespace/%25name/gapic_version.py.j2
https://github.com/googleapis/gapic-generator-python/blob/main/gapic/templates/%25namespace/%25name_%25version/gapic_version.py.j2
gapic-generator-python/gapic/samplegen_utils/snippet_index.py
Lines 122 to 124 in c084bd4
By adding a
gapic-versionoption we will be able to eliminate the diff because the GAPIC generator will populate the desired version.This work is needed for the librarian migration project in order to remove the need for
one-time-generated-filesas communicated in googleapis/librarian#1922 (comment)This will also prevent issues like googleapis/librarian#2254 (comment) where an unexpected change in the
dlpversion number in snippet metadata caused incorrect conventional commits to be associated with the library.Fixes googleapis/librarian#2271