@@ -49,6 +49,7 @@ def s3_store(
4949 force_path_style : bool = False ,
5050) -> ObjectStoreConfig .S3Compatible | ObjectStoreConfig .S3 :
5151 """Build an ObjectStoreConfig instance for S3 or S3 compatible object stores."""
52+
5253 options = S3Options (
5354 region = region ,
5455 endpoint_url = endpoint_url ,
@@ -76,6 +77,7 @@ def s3_storage(
7677 anonymous : bool | None = None ,
7778 from_env : bool | None = None ,
7879 get_credentials : Callable [[], S3StaticCredentials ] | None = None ,
80+ scatter_initial_credentials : bool = False ,
7981 force_path_style : bool = False ,
8082) -> Storage :
8183 """Create a Storage instance that saves data in S3 or S3 compatible object stores.
@@ -106,6 +108,12 @@ def s3_storage(
106108 Fetch credentials from the operative system environment
107109 get_credentials: Callable[[], S3StaticCredentials] | None
108110 Use this function to get and refresh object store credentials
111+ scatter_initial_credentials: bool, optional
112+ Immediately call and store the value returned by get_credentials. This is useful if the
113+ repo or session will be pickled to generate many copies. Passing scatter_initial_credentials=True will
114+ ensure all those copies don't need to call get_credentials immediately. After the initial
115+ set of credentials has expired, the cached value is no longer used. Notice that credentials
116+ obtained are stored, and they can be sent over the network if you pickle the session/repo.
109117 force_path_style: bool
110118 Whether to force using path-style addressing for buckets
111119 """
@@ -118,6 +126,7 @@ def s3_storage(
118126 anonymous = anonymous ,
119127 from_env = from_env ,
120128 get_credentials = get_credentials ,
129+ scatter_initial_credentials = scatter_initial_credentials ,
121130 )
122131 options = S3Options (
123132 region = region ,
@@ -186,6 +195,7 @@ def tigris_storage(
186195 anonymous : bool | None = None ,
187196 from_env : bool | None = None ,
188197 get_credentials : Callable [[], S3StaticCredentials ] | None = None ,
198+ scatter_initial_credentials : bool = False ,
189199) -> Storage :
190200 """Create a Storage instance that saves data in Tigris object store.
191201
@@ -219,6 +229,12 @@ def tigris_storage(
219229 Fetch credentials from the operative system environment
220230 get_credentials: Callable[[], S3StaticCredentials] | None
221231 Use this function to get and refresh object store credentials
232+ scatter_initial_credentials: bool, optional
233+ Immediately call and store the value returned by get_credentials. This is useful if the
234+ repo or session will be pickled to generate many copies. Passing scatter_initial_credentials=True will
235+ ensure all those copies don't need to call get_credentials immediately. After the initial
236+ set of credentials has expired, the cached value is no longer used. Notice that credentials
237+ obtained are stored, and they can be sent over the network if you pickle the session/repo.
222238 """
223239 credentials = s3_credentials (
224240 access_key_id = access_key_id ,
@@ -228,6 +244,7 @@ def tigris_storage(
228244 anonymous = anonymous ,
229245 from_env = from_env ,
230246 get_credentials = get_credentials ,
247+ scatter_initial_credentials = scatter_initial_credentials ,
231248 )
232249 options = S3Options (region = region , endpoint_url = endpoint_url , allow_http = allow_http )
233250 return Storage .new_tigris (
@@ -254,6 +271,7 @@ def r2_storage(
254271 anonymous : bool | None = None ,
255272 from_env : bool | None = None ,
256273 get_credentials : Callable [[], S3StaticCredentials ] | None = None ,
274+ scatter_initial_credentials : bool = False ,
257275) -> Storage :
258276 """Create a Storage instance that saves data in Tigris object store.
259277
@@ -287,6 +305,12 @@ def r2_storage(
287305 Fetch credentials from the operative system environment
288306 get_credentials: Callable[[], S3StaticCredentials] | None
289307 Use this function to get and refresh object store credentials
308+ scatter_initial_credentials: bool, optional
309+ Immediately call and store the value returned by get_credentials. This is useful if the
310+ repo or session will be pickled to generate many copies. Passing scatter_initial_credentials=True will
311+ ensure all those copies don't need to call get_credentials immediately. After the initial
312+ set of credentials has expired, the cached value is no longer used. Notice that credentials
313+ obtained are stored, and they can be sent over the network if you pickle the session/repo.
290314 """
291315 credentials = s3_credentials (
292316 access_key_id = access_key_id ,
@@ -296,6 +320,7 @@ def r2_storage(
296320 anonymous = anonymous ,
297321 from_env = from_env ,
298322 get_credentials = get_credentials ,
323+ scatter_initial_credentials = scatter_initial_credentials ,
299324 )
300325 options = S3Options (region = region , endpoint_url = endpoint_url , allow_http = allow_http )
301326 return Storage .new_r2 (
@@ -318,6 +343,7 @@ def gcs_storage(
318343 from_env : bool | None = None ,
319344 config : dict [str , str ] | None = None ,
320345 get_credentials : Callable [[], GcsBearerCredential ] | None = None ,
346+ scatter_initial_credentials : bool = False ,
321347) -> Storage :
322348 """Create a Storage instance that saves data in Google Cloud Storage object store.
323349
@@ -333,6 +359,12 @@ def gcs_storage(
333359 The bearer token to use for the object store
334360 get_credentials: Callable[[], GcsBearerCredential] | None
335361 Use this function to get and refresh object store credentials
362+ scatter_initial_credentials: bool, optional
363+ Immediately call and store the value returned by get_credentials. This is useful if the
364+ repo or session will be pickled to generate many copies. Passing scatter_initial_credentials=True will
365+ ensure all those copies don't need to call get_credentials immediately. After the initial
366+ set of credentials has expired, the cached value is no longer used. Notice that credentials
367+ obtained are stored, and they can be sent over the network if you pickle the session/repo.
336368 """
337369 credentials = gcs_credentials (
338370 service_account_file = service_account_file ,
@@ -341,6 +373,7 @@ def gcs_storage(
341373 bearer_token = bearer_token ,
342374 from_env = from_env ,
343375 get_credentials = get_credentials ,
376+ scatter_initial_credentials = scatter_initial_credentials ,
344377 )
345378 return Storage .new_gcs (
346379 bucket = bucket ,
0 commit comments