Registry / gcp / google-gax

google-gax

JSON →
library0.16.0pypypiunverified

Google API Extensions (GAX) was an early Python library for generating client libraries for Google APIs. It provided common features like retries, authentication, and request handling. This project is now deprecated (since version 0.16.0) and has been wholly replaced by `google-api-core`. New development should use `google-api-core` and its associated client libraries.

pip install google-gax
INSTALL
IMPORT
SIG · GOOGLE-GAX
G
google-gax
gcppythonv0.16.0
Install
6.1s avg
Import
Disk
61MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.16.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 55.4MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 6.1s · import 0.000s · 55MB
61MB installed
● package 61MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

api_callable
from google.api_core.gapic_v1 import api_callable
from google.api_core.gapic_v1 import api_callable

This quickstart demonstrates how to use `google-api-core`'s `Retry` mechanism, which directly replaces core functionality previously found in `google-gax`. It shows a simple example of retrying an intermittently failing function, illustrating the correct modern approach for handling transient errors in Google Cloud client libraries. **Note:** Direct usage of `google-gax` is deprecated and not recommended for new projects.

from google.api_core.retry import Retry from google.api_core.exceptions import ServiceUnavailable import time # --- This example demonstrates google-api-core, the replacement for google-gax --- _failure_count = 0 def might_fail_api_call(): """A dummy function simulating an API call that fails intermittently.""" global _failure_count _failure_count += 1 if _failure_count < 3: print(f"Attempt {_failure_count}: API call failing with ServiceUnavailable...") raise ServiceUnavailable("Backend service is temporarily unavailable.") print(f"Attempt {_failure_count}: API call succeeded!") return "Data Retrieved!" # Define a retry policy for ServiceUnavailable errors # This replaces similar functionality found in google-gax.retry retry_policy = Retry( predicate=Retry.if_exception_type(ServiceUnavailable), initial=1.0, # Initial delay of 1 second multiplier=2.0, # Double delay each time maximum=10.0, # Max delay of 10 seconds deadline=30.0 # Total operation timeout of 30 seconds ) try: print("\n--- Calling the API with google-api-core retry policy ---") result = retry_policy(might_fail_api_call) print(f"Final Result: {result}") except Exception as e: print(f"Operation failed after retries: {e}") # For actual Google Cloud client libraries, this retry mechanism # is often automatically configured and used internally.
Debug
Known issues
breakingThe `google-gax` library is officially deprecated as of version 0.16.0 and will no longer receive updates or support. All functionality has been migrated to `google-api-core`.
fix
Migrate all existing code to use `google-api-core`. Update imports and adjust configuration settings as documented in `google-api-core`'s official documentation. See problem section for specific import changes.
affects: 0.16.0 and later
gotchaUsing `google-gax` in new projects or alongside modern Google Cloud client libraries can lead to dependency conflicts, outdated behavior, and lack of support for new features or security patches.
fix
Always use `google-api-core` and the latest versions of Google Cloud client libraries. Review your project dependencies to ensure `google-gax` is not implicitly pulled in by older transitive dependencies.
affects: All versions, especially when mixed with newer libraries.
Upgrade
Version history
0.16.0latest on PyPI · released Feb 28, 2018
Audit
Dependencies
google-api-corerequiredThis library is the official replacement for google-gax and provides the same, improved functionality.
Agent activity
39 hits · last 30 days
node
36
OpenAI (training)
1
Resources
google-gax — pip install google-gax · libregistry