diff --git a/icechunk-python/python/icechunk/__init__.py b/icechunk-python/python/icechunk/__init__.py index f5621bf5..863d9d96 100644 --- a/icechunk-python/python/icechunk/__init__.py +++ b/icechunk-python/python/icechunk/__init__.py @@ -14,6 +14,7 @@ ConflictType, Credentials, Diff, + GcsBearerCredential, GcsCredentials, GcsStaticCredentials, GCSummary, @@ -95,6 +96,7 @@ "Credentials", "Diff", "GCSummary", + "GcsBearerCredential", "GcsCredentials", "GcsStaticCredentials", "IcechunkError", diff --git a/icechunk-python/python/icechunk/storage.py b/icechunk-python/python/icechunk/storage.py index 2abc8a73..70e87ee3 100644 --- a/icechunk-python/python/icechunk/storage.py +++ b/icechunk-python/python/icechunk/storage.py @@ -2,6 +2,7 @@ from datetime import datetime from icechunk._icechunk_python import ( + GcsBearerCredential, ObjectStoreConfig, S3Options, S3StaticCredentials, @@ -222,6 +223,7 @@ def gcs_storage( bearer_token: str | None = None, from_env: bool | None = None, config: dict[str, str] | None = None, + get_credentials: Callable[[], GcsBearerCredential] | None = None, ) -> Storage: """Create a Storage instance that saves data in Google Cloud Storage object store. @@ -235,6 +237,8 @@ def gcs_storage( Fetch credentials from the operative system environment bearer_token: str | None The bearer token to use for the object store + get_credentials: Callable[[], GcsBearerCredential] | None + Use this function to get and refresh object store credentials """ credentials = gcs_credentials( service_account_file=service_account_file, @@ -242,6 +246,7 @@ def gcs_storage( application_credentials=application_credentials, bearer_token=bearer_token, from_env=from_env, + get_credentials=get_credentials, ) return Storage.new_gcs( bucket=bucket, diff --git a/icechunk-python/tests/test_credentials.py b/icechunk-python/tests/test_credentials.py index d575afef..e598d7d5 100644 --- a/icechunk-python/tests/test_credentials.py +++ b/icechunk-python/tests/test_credentials.py @@ -113,7 +113,7 @@ def __call__(self) -> S3StaticCredentials: ) -def test_refreshable_credentials_refresh(tmp_path: Path) -> None: +def test_s3_refreshable_credentials_refresh(tmp_path: Path) -> None: path = tmp_path / "calls.txt" creds_obj = ExpirableCredentials(path)