Remove google-genai compat shim, require 2.12+ - #1709
Closed
DABH wants to merge 1 commit into
Closed
Conversation
google-genai 2.12.0 is now past the two-week exclude-newer window, so the dependency floor can move to >=2.12.0 and the _compat.py shim from #1652 is no longer needed. Interaction is imported from its defining module, which both runtime and type checkers resolve to the resource class (the public google.genai.interactions.Interaction still resolves to a TypeAliasType for type checkers; tracked upstream in googleapis/python-genai#2732). Lockfile: google-genai 2.11.0 -> 2.12.1; google-auth downgraded to 2.55.2 per 2.12.1's google-auth<2.56.0 constraint.
tconley1428
reviewed
Jul 31, 2026
| import pytest | ||
| from google.genai import Client as GeminiClient | ||
| from google.genai import types | ||
| from google.genai._gaos.types.interactions.interaction import Interaction |
Contributor
There was a problem hiding this comment.
We're using internal imports to fix this?
Contributor
Author
|
Don't really like internal imports, don't think this improves quality over using a shim. Going to close this and just wait for Google to fix the root issue upstream so we don't need shims or internal imports. Then will do the real PR I want (no shims or internal imports) down the line. |
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.
What
Follow-up to #1652, as agreed there: now that google-genai 2.12.0 is past the two-week
exclude-newerwindow, raise the dependency floor to>=2.12.0,<3.0.0, delete the_compat.pyshim, and importInteractiondirectly from its defining module at the three former shim call sites.Why
The shim existed only to keep type checking working across the 2.10–2.12 range. With 2.12 as the floor, the conditional runtime/static split is unnecessary — the defining-module import (
google.genai._gaos.types.interactions.interaction) is the one form that both runtime and type checkers resolve to the resource class. The publicgoogle.genai.interactions.Interactionstill resolves to aTypeAliasTypeunder type checkers on every release through 2.16.0 (verified with mypy against 2.12.1 and 2.16.0), and the upstream fix (googleapis/python-genai#2732) has not landed, so the public import can't be restored yet.Lockfile notes: google-genai moves to 2.12.1, which also forces google-auth down to 2.55.2 (2.12.1 pins
google-auth<2.56.0).Verification
mypy,pyright, andbasedpyrightclean ontemporalio/contrib/google_genai/andtests/contrib/google_genai/against 2.12.1tests/contrib/google_genai/tests pass against 2.12.1