Google Cloud Common API client library
google-cloud-common is a foundational Python library that provides generated Python types and common helpers for other Google Cloud client libraries. It is not typically used as a standalone application client but serves as an internal dependency for service-specific client libraries within the `google-cloud-python` ecosystem. The current version is 1.9.0. It is actively maintained as part of the broader Google Cloud Python client libraries, which have a frequent release cadence.
Warnings
- gotcha google-cloud-common is an internal dependency and provides generated Python types and common helpers. It is not intended for direct use by end-users for performing Google Cloud service operations. Instead, it is a building block for other service-specific client libraries (e.g., `google-cloud-storage`, `google-cloud-pubsub`).
- breaking While `google-cloud-common==1.9.0` currently supports Python >=3.9, the broader Google Cloud Python client library ecosystem is actively dropping support for older Python versions. For example, `pandas-gbq` recently dropped Python 3.9 support in `v0.35.0` (released 2026-04-09), requiring Python 3.10+.
- gotcha The library utilizes standard Python logging functionality. Logs may contain sensitive information. By default, logging events from `google-cloud-common` (and other `google` namespace loggers) are not propagated up to the root logger.
Install
-
pip install google-cloud-common
Imports
- google.cloud.common
This library is primarily an internal dependency; direct end-user imports for functional use are rare. Its components are typically consumed by other `google-cloud-*` client libraries.
Quickstart
import os
from google.cloud import storage
# This example uses google-cloud-storage, which relies on common infrastructure
# like that provided by google-cloud-common for its base functionality and types.
# Ensure GOOGLE_APPLICATION_CREDENTIALS environment variable is set
# or running in a Google Cloud environment with default credentials.
# For local development, set GOOGLE_APPLICATION_CREDENTIALS to the path of your service account key file.
# os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '/path/to/your/key.json'
try:
# Initialize a client for Google Cloud Storage
# This implicitly uses authentication mechanisms supported by google-cloud-common's underlying components.
client = storage.Client()
# Attempt to list buckets to verify authentication and client setup
buckets = list(client.list_buckets())
print(f"Successfully listed {len(buckets)} buckets.")
if buckets:
print(f"First bucket: {buckets[0].name}")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure your Google Cloud environment is set up and authenticated.")
print(" - Set GOOGLE_APPLICATION_CREDENTIALS to your service account key file path, or")
print(" - Run in a Google Cloud environment (e.g., Cloud Shell, GCE, Cloud Run).")