digitalhub 0.9.0__py3-none-any.whl → 0.9.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of digitalhub might be problematic. Click here for more details.

@@ -13,7 +13,6 @@ from digitalhub.readers.api import get_reader_by_object
13
13
  from digitalhub.stores._base.store import Store, StoreConfig
14
14
  from digitalhub.utils.exceptions import StoreError
15
15
  from digitalhub.utils.file_utils import get_file_info_from_s3, get_file_mime_type
16
- from digitalhub.utils.s3_utils import get_bucket_name
17
16
 
18
17
  # Type aliases
19
18
  S3Client = Type["botocore.client.S3"]
@@ -77,7 +76,7 @@ class S3Store(Store):
77
76
  str
78
77
  Destination path of the downloaded artifact.
79
78
  """
80
- client, bucket = self._check_factory(root)
79
+ client, bucket = self._check_factory()
81
80
 
82
81
  # Build destination directory
83
82
  if dst.suffix == "":
@@ -127,18 +126,14 @@ class S3Store(Store):
127
126
  return str(Path(dst, trees[0]))
128
127
  return str(dst)
129
128
 
130
- def upload(
131
- self,
132
- src: str | list[str],
133
- dst: str,
134
- ) -> list[tuple[str, str]]:
129
+ def upload(self, src: str | list[str], dst: str | None = None) -> list[tuple[str, str]]:
135
130
  """
136
131
  Upload an artifact to storage.
137
132
 
138
133
  Parameters
139
134
  ----------
140
- src : str | list[str]
141
- Source(s).
135
+ src : str
136
+ List of sources.
142
137
  dst : str
143
138
  The destination of the artifact on storage.
144
139
 
@@ -148,11 +143,18 @@ class S3Store(Store):
148
143
  Returns the list of destination and source paths of the uploaded artifacts.
149
144
  """
150
145
  # Destination handling
151
- key = self._get_key(dst)
152
146
 
153
- # Source handling (files list, dir or single file)
154
- src_is_list = isinstance(src, list)
155
- if not src_is_list:
147
+ # If no destination is provided, build key from source
148
+ # Otherwise build key from destination
149
+ if dst is None:
150
+ raise StoreError(
151
+ "Destination must be provided. If source is a list of files or a directory, destination must be a partition, e.g. 's3://bucket/partition/' otherwise a destination key, e.g. 's3://bucket/key'"
152
+ )
153
+ else:
154
+ dst = self._get_key(dst)
155
+
156
+ # Source handling
157
+ if not isinstance(src, list):
156
158
  self._check_local_src(src)
157
159
  src_is_dir = Path(src).is_dir()
158
160
  else:
@@ -163,31 +165,21 @@ class S3Store(Store):
163
165
  src = src[0]
164
166
 
165
167
  # If source is a directory, destination must be a partition
166
- if (src_is_dir or src_is_list) and not dst.endswith("/"):
167
- raise StoreError(
168
- "If source is a list of files or a directory, "
169
- "destination must be a partition, e.g. 's3://bucket/partition/'"
170
- )
171
-
172
- # S3 client
173
- client, bucket = self._check_factory(dst)
168
+ if (src_is_dir or isinstance(src, list)) and not dst.endswith("/"):
169
+ raise StoreError("Destination must be a partition if the source is a directory or a list of files.")
174
170
 
175
171
  # Directory
176
172
  if src_is_dir:
177
- return self._upload_dir(src, key, client, bucket)
173
+ return self._upload_dir(src, dst)
178
174
 
179
175
  # List of files
180
- elif src_is_list:
181
- return self._upload_file_list(src, key, client, bucket)
176
+ elif isinstance(src, list):
177
+ return self._upload_file_list(src, dst)
182
178
 
183
179
  # Single file
184
- return self._upload_single_file(src, key, client, bucket)
180
+ return self._upload_single_file(src, dst)
185
181
 
186
- def upload_fileobject(
187
- self,
188
- src: BytesIO,
189
- dst: str,
190
- ) -> str:
182
+ def upload_fileobject(self, src: BytesIO, dst: str) -> str:
191
183
  """
192
184
  Upload an BytesIO to S3 based storage.
193
185
 
@@ -196,23 +188,18 @@ class S3Store(Store):
196
188
  src : BytesIO
197
189
  The source object to be persisted.
198
190
  dst : str
199
- The destination path of the artifact.
191
+ The destination partition for the artifact.
200
192
 
201
193
  Returns
202
194
  -------
203
195
  str
204
196
  S3 key of the uploaded artifact.
205
197
  """
206
- client, bucket = self._check_factory(dst)
207
- key = self._get_key(dst)
208
- self._upload_fileobject(src, key, client, bucket)
209
- return f"s3://{bucket}/{key}"
198
+ client, bucket = self._check_factory()
199
+ self._upload_fileobject(src, dst, client, bucket)
200
+ return f"s3://{bucket}/{dst}"
210
201
 
211
- def get_file_info(
212
- self,
213
- root: str,
214
- paths: list[tuple[str, str]],
215
- ) -> list[dict]:
202
+ def get_file_info(self, paths: list[tuple[str, str]]) -> list[dict]:
216
203
  """
217
204
  Method to get file metadata.
218
205
 
@@ -226,7 +213,7 @@ class S3Store(Store):
226
213
  list[dict]
227
214
  Returns files metadata.
228
215
  """
229
- client, bucket = self._check_factory(root)
216
+ client, bucket = self._check_factory()
230
217
 
231
218
  infos = []
232
219
  for i in paths:
@@ -277,13 +264,7 @@ class S3Store(Store):
277
264
  # Download file
278
265
  client.download_file(bucket, key, dst_pth)
279
266
 
280
- def _upload_dir(
281
- self,
282
- src: str,
283
- dst: str,
284
- client: S3Client,
285
- bucket: str,
286
- ) -> list[tuple[str, str]]:
267
+ def _upload_dir(self, src: str, dst: str) -> list[tuple[str, str]]:
287
268
  """
288
269
  Upload directory to storage.
289
270
 
@@ -293,16 +274,14 @@ class S3Store(Store):
293
274
  List of sources.
294
275
  dst : str
295
276
  The destination of the artifact on storage.
296
- client : S3Client
297
- The S3 client object.
298
- bucket : str
299
- The name of the S3 bucket.
300
277
 
301
278
  Returns
302
279
  -------
303
280
  list[tuple[str, str]]
304
281
  Returns the list of destination and source paths of the uploaded artifacts.
305
282
  """
283
+ client, bucket = self._check_factory()
284
+
306
285
  # Get list of files
307
286
  src_pth = Path(src)
308
287
  files = [i for i in src_pth.rglob("*") if i.is_file()]
@@ -320,13 +299,7 @@ class S3Store(Store):
320
299
  paths.append((k, str(f.relative_to(src_pth))))
321
300
  return paths
322
301
 
323
- def _upload_file_list(
324
- self,
325
- src: list[str],
326
- dst: str,
327
- client: S3Client,
328
- bucket: str,
329
- ) -> list[tuple[str, str]]:
302
+ def _upload_file_list(self, src: list[str], dst: str) -> list[tuple[str, str]]:
330
303
  """
331
304
  Upload list of files to storage.
332
305
 
@@ -336,16 +309,13 @@ class S3Store(Store):
336
309
  List of sources.
337
310
  dst : str
338
311
  The destination of the artifact on storage.
339
- client : S3Client
340
- The S3 client object.
341
- bucket : str
342
- The name of the S3 bucket.
343
312
 
344
313
  Returns
345
314
  -------
346
315
  list[tuple[str, str]]
347
316
  Returns the list of destination and source paths of the uploaded artifacts.
348
317
  """
318
+ client, bucket = self._check_factory()
349
319
  files = src
350
320
  keys = []
351
321
  for i in files:
@@ -360,13 +330,7 @@ class S3Store(Store):
360
330
  paths.append((k, Path(f).name))
361
331
  return paths
362
332
 
363
- def _upload_single_file(
364
- self,
365
- src: str,
366
- dst: str,
367
- client: S3Client,
368
- bucket: str,
369
- ) -> str:
333
+ def _upload_single_file(self, src: str, dst: str) -> str:
370
334
  """
371
335
  Upload a single file to storage.
372
336
 
@@ -376,16 +340,14 @@ class S3Store(Store):
376
340
  List of sources.
377
341
  dst : str
378
342
  The destination of the artifact on storage.
379
- client : S3Client
380
- The S3 client object.
381
- bucket : str
382
- The name of the S3 bucket.
383
343
 
384
344
  Returns
385
345
  -------
386
346
  str
387
347
  Returns the list of destination and source paths of the uploaded artifacts.
388
348
  """
349
+ client, bucket = self._check_factory()
350
+
389
351
  if dst.endswith("/"):
390
352
  dst = f"{dst.removeprefix('/')}{Path(src).name}"
391
353
 
@@ -395,12 +357,7 @@ class S3Store(Store):
395
357
  return [(dst, name)]
396
358
 
397
359
  @staticmethod
398
- def _upload_file(
399
- src: str,
400
- key: str,
401
- client: S3Client,
402
- bucket: str,
403
- ) -> None:
360
+ def _upload_file(src: str, key: str, client: S3Client, bucket: str) -> None:
404
361
  """
405
362
  Upload a file to S3 based storage. The function checks if the
406
363
  bucket is accessible.
@@ -427,12 +384,7 @@ class S3Store(Store):
427
384
  client.upload_file(Filename=src, Bucket=bucket, Key=key, ExtraArgs=extra_args)
428
385
 
429
386
  @staticmethod
430
- def _upload_fileobject(
431
- fileobj: BytesIO,
432
- key: str,
433
- client: S3Client,
434
- bucket: str,
435
- ) -> None:
387
+ def _upload_fileobject(fileobj: BytesIO, key: str, client: S3Client, bucket: str) -> None:
436
388
  """
437
389
  Upload a fileobject to S3 based storage. The function checks if the bucket is accessible.
438
390
 
@@ -457,13 +409,7 @@ class S3Store(Store):
457
409
  # Datastore methods
458
410
  ##############################
459
411
 
460
- def write_df(
461
- self,
462
- df: Any,
463
- dst: str,
464
- extension: str | None = None,
465
- **kwargs,
466
- ) -> str:
412
+ def write_df(self, df: Any, dst: str, extension: str | None = None, **kwargs) -> str:
467
413
  """
468
414
  Write a dataframe to S3 based storage. Kwargs are passed to df.to_parquet().
469
415
 
@@ -473,8 +419,6 @@ class S3Store(Store):
473
419
  The dataframe.
474
420
  dst : str
475
421
  The destination path on S3 based storage.
476
- extension : str
477
- The extension of the file.
478
422
  **kwargs : dict
479
423
  Keyword arguments.
480
424
 
@@ -486,13 +430,15 @@ class S3Store(Store):
486
430
  fileobj = BytesIO()
487
431
  reader = get_reader_by_object(df)
488
432
  reader.write_df(df, fileobj, extension=extension, **kwargs)
489
- return self.upload_fileobject(fileobj, dst)
433
+
434
+ key = self._get_key(dst)
435
+ return self.upload_fileobject(fileobj, key)
490
436
 
491
437
  ##############################
492
438
  # Helper methods
493
439
  ##############################
494
440
 
495
- def _get_bucket(self, root: str) -> str:
441
+ def _get_bucket(self) -> str:
496
442
  """
497
443
  Get the name of the S3 bucket from the URI.
498
444
 
@@ -501,7 +447,7 @@ class S3Store(Store):
501
447
  str
502
448
  The name of the S3 bucket.
503
449
  """
504
- return get_bucket_name(root)
450
+ return str(self.config.bucket_name)
505
451
 
506
452
  def _get_client(self) -> S3Client:
507
453
  """
@@ -519,7 +465,7 @@ class S3Store(Store):
519
465
  }
520
466
  return boto3.client("s3", **cfg)
521
467
 
522
- def _check_factory(self, root: str) -> tuple[S3Client, str]:
468
+ def _check_factory(self) -> tuple[S3Client, str]:
523
469
  """
524
470
  Check if the S3 bucket is accessible by sending a head_bucket request.
525
471
 
@@ -529,7 +475,7 @@ class S3Store(Store):
529
475
  A tuple containing the S3 client object and the name of the S3 bucket.
530
476
  """
531
477
  client = self._get_client()
532
- bucket = self._get_bucket(root)
478
+ bucket = self._get_bucket()
533
479
  self._check_access_to_storage(client, bucket)
534
480
  return client, bucket
535
481
 
@@ -99,11 +99,7 @@ class SqlStore(Store):
99
99
  table = self._get_table_name(root)
100
100
  return self._download_table(schema, table, str(dst))
101
101
 
102
- def upload(
103
- self,
104
- src: str | list[str],
105
- dst: str,
106
- ) -> list[tuple[str, str]]:
102
+ def upload(self, src: str | list[str], dst: str | None = None) -> list[tuple[str, str]]:
107
103
  """
108
104
  Upload an artifact to storage.
109
105
 
@@ -114,11 +110,7 @@ class SqlStore(Store):
114
110
  """
115
111
  raise StoreError("SQL store does not support upload.")
116
112
 
117
- def get_file_info(
118
- self,
119
- root: str,
120
- paths: list[tuple[str, str]],
121
- ) -> list[dict]:
113
+ def get_file_info(self, paths: list[str]) -> list[dict]:
122
114
  """
123
115
  Get file information from SQL based storage.
124
116
 
@@ -7,23 +7,6 @@ from urllib.parse import urlparse
7
7
  from boto3 import client as boto3_client
8
8
 
9
9
 
10
- def get_bucket_name(path: str) -> str:
11
- """
12
- Get bucket name from path.
13
-
14
- Parameters
15
- ----------
16
- path : str
17
- The source path to get the key from.
18
-
19
- Returns
20
- -------
21
- str
22
- The bucket name.
23
- """
24
- return urlparse(path).netloc
25
-
26
-
27
10
  def get_bucket_and_key(path: str) -> tuple[str, str]:
28
11
  """
29
12
  Get bucket and key from path.
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2024 DSLab, Fondazione Bruno Kessler
189
+ Copyright [yyyy] [name of copyright owner]
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: digitalhub
3
- Version: 0.9.0
3
+ Version: 0.9.0b1
4
4
  Summary: Python SDK for Digitalhub
5
5
  Author-email: Fondazione Bruno Kessler <dslab@fbk.eu>, Matteo Martini <mmartini@fbk.eu>
6
6
  License: Apache License
@@ -191,7 +191,7 @@ License: Apache License
191
191
  same "printed page" as the copyright notice for easier
192
192
  identification within third-party archives.
193
193
 
194
- Copyright 2024 DSLab, Fondazione Bruno Kessler
194
+ Copyright [yyyy] [name of copyright owner]
195
195
 
196
196
  Licensed under the Apache License, Version 2.0 (the "License");
197
197
  you may not use this file except in compliance with the License.
@@ -4,20 +4,17 @@ digitalhub/client/api.py,sha256=JwYh4rFUaTeZ2MvUdhQiWEG1AZbrZjRYMhJHoDRnk30,586
4
4
  digitalhub/client/builder.py,sha256=83PoMCus4s4nbkoWmvcjW2hIpXbNx74sUW93wgQgbuo,1195
5
5
  digitalhub/client/_base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  digitalhub/client/_base/api_builder.py,sha256=kB0phBqaPTLayyXyA1GbHgnbo4bBkadBtimznVB3-jc,339
7
- digitalhub/client/_base/client.py,sha256=Z2iVRCyEzR1-B2uUh9uGQVuCpLFOE0UL64kEXhyf2aI,2974
8
- digitalhub/client/_base/key_builder.py,sha256=xl3jM7z2eLP6HfPXusmZyLqsvfKHQfxfZ3SWPS7MHuk,1155
7
+ digitalhub/client/_base/client.py,sha256=wXHfHQANnv_2AlW6yh7dnxI3i0bBASsP_gYSbc-YQHk,2063
9
8
  digitalhub/client/dhcore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
9
  digitalhub/client/dhcore/api_builder.py,sha256=IkRnANGG3dQmu4t1KmSnpDxGqkZDnJpBP9CcUhWZliQ,3652
11
- digitalhub/client/dhcore/client.py,sha256=rYNSv-UpxoksaZki19A4pCch0tHlGIId9eDuFCfdxDk,21297
10
+ digitalhub/client/dhcore/client.py,sha256=Vl0ZRX1CHxOg9awR-liFagTMkbNLcW2B4jGfxJt0udk,21149
12
11
  digitalhub/client/dhcore/enums.py,sha256=kaVXZTTa2WmsFbcc1CKWNLOM0JtUtcjL-KpspnTOhEE,523
13
12
  digitalhub/client/dhcore/env.py,sha256=zBUNbK8G8PyMGAw_65BnX2Z_WUkrmTyQmYhLE6Jqgvk,618
14
- digitalhub/client/dhcore/key_builder.py,sha256=VyyHk18rs1z8FKoRXGD2glb_WCipCWoYsS50_jYQpC4,1317
15
13
  digitalhub/client/dhcore/models.py,sha256=KiTg5xR8EzI7Xa1pmYmzixabLdnqlnn5kn-IILZDGIw,900
16
14
  digitalhub/client/dhcore/utils.py,sha256=I6m26WiGMCEyPa6Yv5hk3nmqWV4jDFjYyI590f86Ebs,3136
17
15
  digitalhub/client/local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
16
  digitalhub/client/local/api_builder.py,sha256=WR24zuWguJqzUkD7xReO12LtvSkn020UG6LKFcKq77g,3592
19
- digitalhub/client/local/client.py,sha256=3DZI4UOrIJ0C03uhbvmKFpeoe2wY7IhBUHO92yzCikQ,17460
20
- digitalhub/client/local/key_builder.py,sha256=jO5RHMRe5bxygX3rbD7TOqBafvO6FJcEOymsnJbjyuY,1316
17
+ digitalhub/client/local/client.py,sha256=WLpEymgxysRLDdMGm9ds4kKOqHqEXk8MmrU01NR938o,17338
21
18
  digitalhub/context/api.py,sha256=un-_HU7JC3t-eQKleVJ9cCDS8BtQFRHSrP3VDHs3gPU,1099
22
19
  digitalhub/context/builder.py,sha256=ibsjwCbll4RbNc_NplAn-8cX0J8GIXyY41KjtcvlsI4,2037
23
20
  digitalhub/context/context.py,sha256=-xn3ZHNqoifUdRF4vwmLzOkfQrEheFPDQNk2J-q47EI,1456
@@ -30,7 +27,7 @@ digitalhub/entities/_base/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
30
27
  digitalhub/entities/_base/context/entity.py,sha256=4IWC6f0YKpEBPCXrKlkkvnOqT1urQ4mbjwre4LUWxk4,3270
31
28
  digitalhub/entities/_base/entity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
29
  digitalhub/entities/_base/entity/builder.py,sha256=vegnR3aBLhuA371vFVQvMXX4KfpVFl-Z7h1ydt6r6Hg,4518
33
- digitalhub/entities/_base/entity/entity.py,sha256=BFVKE5CToh4JOdwseAGMhdpoCiD3kaGRhNA9SuRCixE,3223
30
+ digitalhub/entities/_base/entity/entity.py,sha256=5QP7ZFZ3fjdC6dL26J4TAc_gAsz4esTYR97PIRiwk04,3162
34
31
  digitalhub/entities/_base/entity/metadata.py,sha256=_ogwoo7NOExxVPml9h1vbbAryFiAVpuEuSBQsd_VRjU,2261
35
32
  digitalhub/entities/_base/entity/spec.py,sha256=t0sPXHCb8zyWyMW_UvTfGyUkG_CUEGz427kvGhsQ8s0,1500
36
33
  digitalhub/entities/_base/entity/status.py,sha256=NHB1kLHefoMhhkt_2BFPNojbWMW_Nc8TTGFQNOiyOt0,1044
@@ -43,25 +40,25 @@ digitalhub/entities/_base/entity/_constructors/uuid.py,sha256=QzG0nsVpGU2UDD5Cjp
43
40
  digitalhub/entities/_base/executable/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
41
  digitalhub/entities/_base/executable/entity.py,sha256=tNQmmABuY90eKWcxePPGu4iaZhDLyL9TdugKVcnnKSY,10079
45
42
  digitalhub/entities/_base/material/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
- digitalhub/entities/_base/material/entity.py,sha256=Gm87nZCKUIredCEucqwZ5T_QGG6cjSuWXKzrw15w-l4,6930
43
+ digitalhub/entities/_base/material/entity.py,sha256=J262BLNeW9yYE_W_K07tnvigSI3BJzIXrPlxqow44M0,6914
47
44
  digitalhub/entities/_base/material/spec.py,sha256=jL1OohnYhUSrdTaFF3Rkw817jIjNY0ewm1wB3tgQ_9c,436
48
45
  digitalhub/entities/_base/material/status.py,sha256=I9yxNLHvsHSRDkKcKGPxlPJrJ7grsrxHxId06wtqVXk,383
49
46
  digitalhub/entities/_base/material/utils.py,sha256=EL-p6XEYlPxQ33II2ish2sVx3hIdPcrgbSh5om7Xfls,2427
50
47
  digitalhub/entities/_base/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
- digitalhub/entities/_base/project/entity.py,sha256=MwK80OCNKN_vxnPajJhErdLS4VQfIWydmfQrscf5OCc,10621
48
+ digitalhub/entities/_base/project/entity.py,sha256=oASIIm1eZH9KCUrtfJDWkL_BjJf6tev0RWFu6Y63T0s,10587
52
49
  digitalhub/entities/_base/runtime_entity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
50
  digitalhub/entities/_base/runtime_entity/builder.py,sha256=vZBftdOrAUICoEJXbqOyozrbMxNRqqoVVxDVjKs2GnI,2414
54
51
  digitalhub/entities/_base/unversioned/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
52
  digitalhub/entities/_base/unversioned/builder.py,sha256=ChEhRXlu1BGNmMHOMu9i9kVMu3uFtwxmgiTO4Il_5oU,1834
56
- digitalhub/entities/_base/unversioned/entity.py,sha256=eQ9BKtqr7-UPgS4fkNdFX2Uh-YddfYrfFmk4Y-6uj7w,862
53
+ digitalhub/entities/_base/unversioned/entity.py,sha256=fNz1dprqbN5y7DJ0cWIibaIEPifCGlzccCJyYglQ-K0,778
57
54
  digitalhub/entities/_base/versioned/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
55
  digitalhub/entities/_base/versioned/builder.py,sha256=0niRbqpCnHqBK0hTQxdrtUl43BbJuGXMLVbruhpUUuU,1896
59
- digitalhub/entities/_base/versioned/entity.py,sha256=xtvVJfmJTfCAA96va1-r7B2j7wbXlkutGMil--PWP4I,885
56
+ digitalhub/entities/_base/versioned/entity.py,sha256=tGu1n2rQ0bRnc6SfUyH8aDp0IhuNwR42PuZSGRmYo2k,802
60
57
  digitalhub/entities/_commons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
58
  digitalhub/entities/_commons/enums.py,sha256=pjhbOMzAABRPbV6XNt-2Lyn2kLWIFBAwpeboCtvnz1w,1861
62
59
  digitalhub/entities/_commons/utils.py,sha256=_HL6zFSCL_2ug4LpXcxK1MJQQhWL34wj1B2q0Ie0TKU,1792
63
60
  digitalhub/entities/_operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
- digitalhub/entities/_operations/processor.py,sha256=baQA_L-NFU5uDfP4M2d3B9VLerbmjK3pFKUkZDZI2Sg,49470
61
+ digitalhub/entities/_operations/processor.py,sha256=yi-L_mltue3WN8xM5Y-zpwUCb4x4psW5uwd1Lx7Rxo4,46663
65
62
  digitalhub/entities/artifact/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
63
  digitalhub/entities/artifact/crud.py,sha256=y69PyoWAYOx-Pl_wnds3M0xSLNbADpdV_xG4zElJ0aI,7824
67
64
  digitalhub/entities/artifact/utils.py,sha256=NNzD2AcIJzmV_Jo_8k5ZcSp2arKcZ07CCIYKn2lvoKM,1320
@@ -103,7 +100,7 @@ digitalhub/entities/function/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
103
100
  digitalhub/entities/function/crud.py,sha256=1-fRWVmOXVV305p0GW0n02FEcengw7QxLxxgxsCC7eM,6592
104
101
  digitalhub/entities/function/_base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
105
102
  digitalhub/entities/function/_base/builder.py,sha256=xTVOpH3GYU-BqtzMEuI3uMtLLvF9IYfrVYMVPkkJc2g,2035
106
- digitalhub/entities/function/_base/entity.py,sha256=YYFxtLAZEhcWOzGlGjqRPXmGRb8wBK1KOXyVPo9ZGSw,3093
103
+ digitalhub/entities/function/_base/entity.py,sha256=VhUQsC5EyJQpCU6FMDRqLIrlJt18g8I6AKd1ZO7320U,3100
107
104
  digitalhub/entities/function/_base/spec.py,sha256=SjCtp3JBUTPTLMY_TE8wM1HPKVl7jH_wFEqQXBj1rfo,274
108
105
  digitalhub/entities/function/_base/status.py,sha256=N-Z1hw13qV7kWFJLQPaH3rRZ2z7AvZeuWYER95lG344,170
109
106
  digitalhub/entities/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -162,7 +159,7 @@ digitalhub/entities/task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
162
159
  digitalhub/entities/task/crud.py,sha256=_TOgqPvD4bOcfxMPJLCzPe4fz_87AP27RG5cC2941oY,5199
163
160
  digitalhub/entities/task/_base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
164
161
  digitalhub/entities/task/_base/builder.py,sha256=21WEbycCR8yaOPcLLcAITaoQ4ZmBNXJXB-Oy0VfSPrg,2358
165
- digitalhub/entities/task/_base/entity.py,sha256=hOTFxWgSrEs2UPrd9pDZAbdWnL_OrkHr6PwxnAkYG2A,3531
162
+ digitalhub/entities/task/_base/entity.py,sha256=KGueJ64puhS7DAzG0_-XZSlUmVIOPOFJbtj1S8iWrpg,3179
166
163
  digitalhub/entities/task/_base/models.py,sha256=lrkQfKEqqMboiDgtqVdTdlFx4FCH_ksJ2Jku1nK6ARw,4741
167
164
  digitalhub/entities/task/_base/spec.py,sha256=2p_QmhXdTXFrkwNyXtEgzUmc4YyedjS-zsnWsvxJDjw,2412
168
165
  digitalhub/entities/task/_base/status.py,sha256=FCSSQscQ0dHEpXdc5vSrIkTXon9FNNOr0M1KVh2ZVAA,162
@@ -171,7 +168,7 @@ digitalhub/entities/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
171
168
  digitalhub/entities/workflow/crud.py,sha256=O_Zq30NG-cy7RU1GG88XNi8ids7vrRJAR95PTMYncGM,6517
172
169
  digitalhub/entities/workflow/_base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
173
170
  digitalhub/entities/workflow/_base/builder.py,sha256=wRgot2pbXjc-Cw549uDo1zFOGKdE7wVqxCboeNoXe-Q,2035
174
- digitalhub/entities/workflow/_base/entity.py,sha256=yQKsoJqWRRgYVQJ0wWvu4krx1DpRM9JL4Irb_874Kqs,2516
171
+ digitalhub/entities/workflow/_base/entity.py,sha256=TFteC2Bpg71qrQ0ni9qnowZUYT3WQ_toEmt2BJIdUeM,2228
175
172
  digitalhub/entities/workflow/_base/spec.py,sha256=UoKOUEqKDFACQwctDWfwhro77m3kvjhLDGOhhfRvEzQ,274
176
173
  digitalhub/entities/workflow/_base/status.py,sha256=W0j0CNdu9o2vbk0awpnDrpgwf_fZpgdtct4s0BxRdyk,170
177
174
  digitalhub/factory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -197,15 +194,15 @@ digitalhub/stores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
197
194
  digitalhub/stores/api.py,sha256=TwD8WXVuEPwtrmcyhP9SC0i7xkVHov5fpu94nHhZRHg,994
198
195
  digitalhub/stores/builder.py,sha256=kraGDfgV5cZ2QivXTWwbyz1FgAehgjlL9dmI6dxEc0U,5927
199
196
  digitalhub/stores/_base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
200
- digitalhub/stores/_base/store.py,sha256=QscqsAAgvYX9bAsoADKs0SkLahmMvvEHZ_NsBj2ri6k,5295
197
+ digitalhub/stores/_base/store.py,sha256=Wc3bHLELO3WW7aQ5Dy9tqHh2nOx7L80cZ1tDwwpb1sQ,5255
201
198
  digitalhub/stores/local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
202
- digitalhub/stores/local/store.py,sha256=_-0JEnGCEcKUrLeB2xf_CDGuSeAEXcNyX6JCvSWkU3M,6766
199
+ digitalhub/stores/local/store.py,sha256=nwOvLvM-DLSqsjlYZLLSoy2pr4pMnaunrwUSi2yNJco,6726
203
200
  digitalhub/stores/remote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
204
- digitalhub/stores/remote/store.py,sha256=g9u87NBfFBasHWSTn82ZRZ0QttpYpX_Y0g16xO1r-AQ,4234
201
+ digitalhub/stores/remote/store.py,sha256=NdA63gyWVKXHlxjoOqi8Vx1jttXDU4GcU0zohV9utjk,4194
205
202
  digitalhub/stores/s3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
206
- digitalhub/stores/s3/store.py,sha256=CzjdMyatPps8uW4HFKz-OZcOUlVlGebUX4jxrzp48Eg,16912
203
+ digitalhub/stores/s3/store.py,sha256=sM2hvSGxf5S6l80GpDzxyr3_v-wAYoMfV-oOiF6TOpc,16263
207
204
  digitalhub/stores/sql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
208
- digitalhub/stores/sql/store.py,sha256=jhulvAIacR0HAomv25PCxG3mr6BKhF-9c9k0D5ruCQ8,10482
205
+ digitalhub/stores/sql/store.py,sha256=epL1TGvWPFjpKBGxqkrfMOEA9-fjakNVbQwSo-YhfNw,10411
209
206
  digitalhub/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
210
207
  digitalhub/utils/data_utils.py,sha256=2eETyxml610Ij7uyDnNc3YiELl2WFLIkj3FL4y6EPk8,2733
211
208
  digitalhub/utils/exceptions.py,sha256=pL2C3vTCscHsjpqDqGN3OXu0bBn7NL9ENOoM2S37CyE,1139
@@ -214,7 +211,7 @@ digitalhub/utils/generic_utils.py,sha256=5flGSQ50UyzUtlnLPyIhZ6blijPGFxPITukfH-y
214
211
  digitalhub/utils/git_utils.py,sha256=aFYL1cpfY-2VnlW7eHmjjjlTLECc5UUUfjb_IQPOY5k,3244
215
212
  digitalhub/utils/io_utils.py,sha256=8jD4Rp_b7LZEpY5JSMxVUowZsnifKnbGpHT5Hijx9-g,3299
216
213
  digitalhub/utils/logger.py,sha256=ml3ne6D8wuRdNZ4F6ywmvWotSxjmZWnmKgNiuHb4R5M,437
217
- digitalhub/utils/s3_utils.py,sha256=kbET2FL7UXfqBMgSpky-E3wO5SMjpaLbIAFtnGe2pXU,1383
214
+ digitalhub/utils/s3_utils.py,sha256=oXLzp4K7o45IwK0XOMt4OElDyB09fKRic5WTNA82WUA,1113
218
215
  digitalhub/utils/uri_utils.py,sha256=IUbR9PjxHr2VghxRG3iyCGpMPSLvL17JLKLZp8kXsgg,3272
219
216
  test/test_crud_functions.py,sha256=tQs_QBaPCuYVSBpbl-he5_6jr_tteCXVmohj1ZluNsA,2769
220
217
  test/test_crud_runs.py,sha256=lkssy15UPJKymgazmi5gG6RLxyTsG-tM_CpNCowD2gQ,2220
@@ -225,9 +222,8 @@ test/local/CRUD/test_artifacts.py,sha256=Y3J_C7SDRSsQd2SGIZjPIOvyTL92B1sTFrUONG3
225
222
  test/local/CRUD/test_dataitems.py,sha256=LQqTzI59uwTGy4zoq8jL0yWVe2W9vXlatkgDU9aB6xg,2968
226
223
  test/local/CRUD/test_models.py,sha256=msosbZuRwIMbZtmi3ZaOva4TjQ4lrzkNu9AguIFhrSo,2929
227
224
  test/local/imports/test_imports.py,sha256=W-YugO0rpJwvtWp57MXaXfEmE-f5iWuCiLY-n0ZU4z8,1271
228
- test/local/instances/test_validate.py,sha256=bGPKRFR_Tb5nlzzmI_ty_6UVUvYGseE2-pkNVoGWeO0,1842
229
- digitalhub-0.9.0.dist-info/LICENSE.txt,sha256=qmrTTXPlgU0kSRlRVbjhlyGs1IXs2QPxo_Y-Mn06J0k,11589
230
- digitalhub-0.9.0.dist-info/METADATA,sha256=ZqP2_g1Syi4Gjh7THCipyW_ytmZ1PKjFcRRP7ra1134,15318
231
- digitalhub-0.9.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
232
- digitalhub-0.9.0.dist-info/top_level.txt,sha256=ae9pDfCF27ZoaVAxuBKONMP0lm5P-N_I-e-no1WlvD8,16
233
- digitalhub-0.9.0.dist-info/RECORD,,
225
+ digitalhub-0.9.0b1.dist-info/LICENSE.txt,sha256=_yVOtnbW7Ss28mp058UEEc1X4Rgj8-kQBP_kj8_Sc88,11585
226
+ digitalhub-0.9.0b1.dist-info/METADATA,sha256=US6XAu95Ktv0yNGQJxqOwkfMLyzPDPsKFS5eb8A-wvk,15316
227
+ digitalhub-0.9.0b1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
228
+ digitalhub-0.9.0b1.dist-info/top_level.txt,sha256=ae9pDfCF27ZoaVAxuBKONMP0lm5P-N_I-e-no1WlvD8,16
229
+ digitalhub-0.9.0b1.dist-info/RECORD,,
@@ -1,52 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from abc import abstractmethod
4
-
5
- from digitalhub.entities._commons.enums import ApiCategories
6
-
7
-
8
- class ClientKeyBuilder:
9
- """
10
- Class that build the key of entities.
11
- """
12
-
13
- def build_key(self, category: str, *args, **kwargs) -> str:
14
- """
15
- Build key.
16
-
17
- Parameters
18
- ----------
19
- category : str
20
- Key category.
21
- *args : tuple
22
- Positional arguments.
23
- **kwargs : dict
24
- Keyword arguments.
25
-
26
- Returns
27
- -------
28
- str
29
- Key.
30
- """
31
- if category == ApiCategories.BASE.value:
32
- return self.base_entity_key(*args, **kwargs)
33
- return self.context_entity_key(*args, **kwargs)
34
-
35
- @abstractmethod
36
- def base_entity_key(self, entity_id: str) -> str:
37
- """
38
- Build for base entity key.
39
- """
40
-
41
- @abstractmethod
42
- def context_entity_key(
43
- self,
44
- project: str,
45
- entity_type: str,
46
- entity_kind: str,
47
- entity_name: str,
48
- entity_id: str | None = None,
49
- ) -> str:
50
- """
51
- Build for context entity key.
52
- """
@@ -1,58 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from digitalhub.client._base.key_builder import ClientKeyBuilder
4
-
5
-
6
- class ClientDHCoreKeyBuilder(ClientKeyBuilder):
7
- """
8
- Class that build the key of entities.
9
- """
10
-
11
- def base_entity_key(self, entity_id: str) -> str:
12
- """
13
- Build for base entity key.
14
-
15
- Parameters
16
- ----------
17
- entity_id : str
18
- Entity id.
19
-
20
- Returns
21
- -------
22
- str
23
- Key.
24
- """
25
- return f"store://{entity_id}"
26
-
27
- def context_entity_key(
28
- self,
29
- project: str,
30
- entity_type: str,
31
- entity_kind: str,
32
- entity_name: str,
33
- entity_id: str | None = None,
34
- ) -> str:
35
- """
36
- Build for context entity key.
37
-
38
- Parameters
39
- ----------
40
- project : str
41
- Project name.
42
- entity_type : str
43
- Entity type.
44
- entity_kind : str
45
- Entity kind.
46
- entity_name : str
47
- Entity name.
48
- entity_id : str
49
- Entity ID.
50
-
51
- Returns
52
- -------
53
- str
54
- Key.
55
- """
56
- if entity_id is None:
57
- return f"store://{project}/{entity_type}/{entity_kind}/{entity_name}"
58
- return f"store://{project}/{entity_type}/{entity_kind}/{entity_name}:{entity_id}"