{"id":9786,"library":"google-gax","title":"Google API Extensions (GAX)","description":"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.","status":"deprecated","version":"0.16.0","language":"python","source_language":"en","source_url":"https://github.com/googleapis/gax-python","tags":["google","api","deprecated","client-libraries","retry"],"install":[{"cmd":"pip install google-gax","lang":"bash","label":"Install google-gax (Deprecated)"},{"cmd":"pip install google-api-core","lang":"bash","label":"Install its replacement: google-api-core"}],"dependencies":[{"reason":"This library is the official replacement for google-gax and provides the same, improved functionality.","package":"google-api-core","optional":false}],"imports":[{"wrong":"from google.api_core.gapic_v1 import api_callable","symbol":"api_callable","correct":"from google.api_core.gapic_v1 import api_callable"}],"quickstart":{"code":"from google.api_core.retry import Retry\nfrom google.api_core.exceptions import ServiceUnavailable\nimport time\n\n# --- This example demonstrates google-api-core, the replacement for google-gax ---\n\n_failure_count = 0\ndef might_fail_api_call():\n    \"\"\"A dummy function simulating an API call that fails intermittently.\"\"\"\n    global _failure_count\n    _failure_count += 1\n    if _failure_count < 3:\n        print(f\"Attempt {_failure_count}: API call failing with ServiceUnavailable...\")\n        raise ServiceUnavailable(\"Backend service is temporarily unavailable.\")\n    print(f\"Attempt {_failure_count}: API call succeeded!\")\n    return \"Data Retrieved!\"\n\n# Define a retry policy for ServiceUnavailable errors\n# This replaces similar functionality found in google-gax.retry\nretry_policy = Retry(\n    predicate=Retry.if_exception_type(ServiceUnavailable),\n    initial=1.0,  # Initial delay of 1 second\n    multiplier=2.0, # Double delay each time\n    maximum=10.0, # Max delay of 10 seconds\n    deadline=30.0 # Total operation timeout of 30 seconds\n)\n\ntry:\n    print(\"\\n--- Calling the API with google-api-core retry policy ---\")\n    result = retry_policy(might_fail_api_call)\n    print(f\"Final Result: {result}\")\nexcept Exception as e:\n    print(f\"Operation failed after retries: {e}\")\n\n# For actual Google Cloud client libraries, this retry mechanism\n# is often automatically configured and used internally.","lang":"python","description":"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."},"warnings":[{"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.","message":"The `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`.","severity":"breaking","affected_versions":"0.16.0 and later"},{"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.","message":"Using `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.","severity":"gotcha","affected_versions":"All versions, especially when mixed with newer libraries."}],"env_vars":null,"search_vec":"'0.16.0':38 'api':2,6,20,47,55,63 'associ':59 'authent':27 'client':16,60,66 'client-librari':65 'common':23 'core':48,56 'deprec':35,64 'develop':50 'earli':11 'extens':3,7 'featur':24 'gax':4,8 'generat':15 'googl':1,5,19,46,54,62 'google-api-cor':45,53 'handl':30 'librari':13,17,61,67 'like':25 'new':49 'project':32 'provid':22 'python':12 'replac':43 'request':29 'retri':26,68 'sinc':36 'use':52 'version':37 'wholli':42","created_at":"2026-04-17T01:20:42.659836+00:00","updated_at":"2026-04-17T01:20:42.659836+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'google.api_core'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.16.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://pypi.org/project/google-gax","github":"https://github.com/googleapis/gax-python","docs":null,"changelog":null,"pypi":"https://pypi.org/project/google-gax/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["gcp","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}