Skip to content

feat: check Python and dependency versions in generated GAPICs #2419

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

vchudnov-g
Copy link
Contributor

Add a check to generated GAPICs to emit the appropriate usage warnings (most prominently, deprecation messages) for unsupported Python runtime versions and dependency versions.

The intent is that before we stop allowing some old versions of a package dependency, we'll have at least one release that adds a warning saying those versions of the dependency are deprecated, before we actually disallow those versions of the dependency in future versions of the GAPICs.

For Python run-times, once we depend on google.api_core after the run-time checks have been implemented (in googleapis/python-api-core#832), these usage/deprecation warnings will be automatic. All we need to do is update the dates for (future) Python versions hard-coded therein.

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Jul 30, 2025
@vchudnov-g
Copy link
Contributor Author

Both the package dependency and the Python run-time checks depend on googleapis/python-api-core#832

@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Jul 31, 2025
The preferred method is still to sue the code in api_core, but we have
a (repetitive) fallback in case users haven't installed the new version that
implements that functionality.
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Aug 1, 2025
return parse_version(version_string)

try:
_dependency_package = "google.protobuf"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this the correct package name? It falls through to the except clause for me when I run the integration tests. Do I need to create a real GAPIC to test this properly?

@vchudnov-g
Copy link
Contributor Author

This PR will now do basic checks even if api_core is not updated, so it is no longer dependent on googleapis/python-api-core#832.

There are still some presubmit failures that I will continue investigating.

@vchudnov-g vchudnov-g marked this pull request as ready for review August 1, 2025 04:35
@vchudnov-g vchudnov-g requested a review from a team as a code owner August 1, 2025 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants