Skip to content

Google Cloud Storage

obstore.store.GCSStore

Configure a connection to Google Cloud Storage.

If no credentials are explicitly provided, they will be sourced from the environment as documented here.

__init__

__init__(
    bucket: str,
    *,
    config: GCSConfig | None = None,
    client_options: ClientConfig | None = None,
    retry_config: RetryConfig | None = None,
    **kwargs: Unpack[GCSConfig],
) -> None

Construct a new GCSStore.

Parameters:

  • bucket (str) –

    The GCS bucket to use.

Other Parameters:

  • config (GCSConfig | None) –

    GCS Configuration. Values in this config will override values inferred from the environment. Defaults to None.

  • client_options (ClientConfig | None) –

    HTTP Client options. Defaults to None.

  • retry_config (RetryConfig | None) –

    Retry configuration. Defaults to None.

Returns:

  • None

    GCSStore

from_env classmethod

from_env(
    bucket: str,
    *,
    config: GCSConfig | None = None,
    client_options: ClientConfig | None = None,
    retry_config: RetryConfig | None = None,
    **kwargs: Unpack[GCSConfig],
) -> GCSStore

Construct a new GCSStore with values pre-populated from environment variables.

Variables extracted from environment:

  • GOOGLE_SERVICE_ACCOUNT: location of service account file
  • GOOGLE_SERVICE_ACCOUNT_PATH: (alias) location of service account file
  • SERVICE_ACCOUNT: (alias) location of service account file
  • GOOGLE_SERVICE_ACCOUNT_KEY: JSON serialized service account key
  • GOOGLE_BUCKET: bucket name
  • GOOGLE_BUCKET_NAME: (alias) bucket name

Parameters:

  • bucket (str) –

    The GCS bucket to use.

Other Parameters:

  • config (GCSConfig | None) –

    GCS Configuration. Values in this config will override values inferred from the environment. Defaults to None.

  • client_options (ClientConfig | None) –

    HTTP Client options. Defaults to None.

  • retry_config (RetryConfig | None) –

    Retry configuration. Defaults to None.

Returns:

from_url classmethod

from_url(
    url: str,
    *,
    config: GCSConfig | None = None,
    client_options: ClientConfig | None = None,
    retry_config: RetryConfig | None = None,
    **kwargs: Unpack[GCSConfig],
) -> GCSStore

Construct a new GCSStore with values populated from a well-known storage URL.

The supported url schemes are:

  • gs://<bucket>/<path>

Note

Note that from_url will not use any additional parts of the path as a bucket prefix. It will only extract the bucket name. If you wish to use a path prefix, consider wrapping this with PrefixStore.

Parameters:

  • url (str) –

    well-known storage URL.

Other Parameters:

  • config (GCSConfig | None) –

    GCS Configuration. Values in this config will override values inferred from the url. Defaults to None.

  • client_options (ClientConfig | None) –

    HTTP Client options. Defaults to None.

  • retry_config (RetryConfig | None) –

    Retry configuration. Defaults to None.

Returns:

obstore.store.GCSConfig

Bases: TypedDict

Configuration parameters for GCSStore.

There are duplicates of many parameters, and parameters can be either upper or lower case. Not all parameters are required.

BUCKET instance-attribute

BUCKET: str

Bucket name.

BUCKET_NAME instance-attribute

BUCKET_NAME: str

Bucket name.

GOOGLE_APPLICATION_CREDENTIALS instance-attribute

GOOGLE_APPLICATION_CREDENTIALS: str

GOOGLE_BUCKET instance-attribute

GOOGLE_BUCKET: str

Bucket name.

GOOGLE_BUCKET_NAME instance-attribute

GOOGLE_BUCKET_NAME: str

Bucket name.

GOOGLE_SERVICE_ACCOUNT instance-attribute

GOOGLE_SERVICE_ACCOUNT: str

Path to the service account file.

GOOGLE_SERVICE_ACCOUNT_KEY instance-attribute

GOOGLE_SERVICE_ACCOUNT_KEY: str

The serialized service account key

GOOGLE_SERVICE_ACCOUNT_PATH instance-attribute

GOOGLE_SERVICE_ACCOUNT_PATH: str

Path to the service account file.

SERVICE_ACCOUNT instance-attribute

SERVICE_ACCOUNT: str

Path to the service account file.

SERVICE_ACCOUNT_KEY instance-attribute

SERVICE_ACCOUNT_KEY: str

The serialized service account key

SERVICE_ACCOUNT_PATH instance-attribute

SERVICE_ACCOUNT_PATH: str

Path to the service account file.

bucket_name instance-attribute

bucket_name: str

Bucket name.

google_application_credentials instance-attribute

google_application_credentials: str

google_bucket instance-attribute

google_bucket: str

Bucket name.

google_bucket_name instance-attribute

google_bucket_name: str

Bucket name.

google_service_account instance-attribute

google_service_account: str

Path to the service account file.

google_service_account_key instance-attribute

google_service_account_key: str

The serialized service account key

google_service_account_path instance-attribute

google_service_account_path: str

Path to the service account file.

service_account instance-attribute

service_account: str

Path to the service account file.

service_account_key instance-attribute

service_account_key: str

The serialized service account key

service_account_path instance-attribute

service_account_path: str

Path to the service account file.