digitalhub 0.8.0__py3-none-any.whl → 0.8.0b0__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.

Files changed (232) hide show
  1. digitalhub/__init__.py +94 -63
  2. {digitalhub-0.8.0.dist-info → digitalhub-0.8.0b0.dist-info}/METADATA +13 -29
  3. digitalhub-0.8.0b0.dist-info/RECORD +14 -0
  4. {digitalhub-0.8.0.dist-info → digitalhub-0.8.0b0.dist-info}/WHEEL +1 -1
  5. test/test_crud_artifacts.py +96 -0
  6. test/test_crud_dataitems.py +96 -0
  7. test/test_crud_functions.py +1 -1
  8. test/test_crud_runs.py +1 -1
  9. test/test_crud_tasks.py +1 -1
  10. digitalhub/client/__init__.py +0 -0
  11. digitalhub/client/_base/__init__.py +0 -0
  12. digitalhub/client/_base/client.py +0 -56
  13. digitalhub/client/api.py +0 -63
  14. digitalhub/client/builder.py +0 -50
  15. digitalhub/client/dhcore/__init__.py +0 -0
  16. digitalhub/client/dhcore/client.py +0 -669
  17. digitalhub/client/dhcore/env.py +0 -21
  18. digitalhub/client/dhcore/models.py +0 -46
  19. digitalhub/client/dhcore/utils.py +0 -111
  20. digitalhub/client/local/__init__.py +0 -0
  21. digitalhub/client/local/client.py +0 -533
  22. digitalhub/context/__init__.py +0 -0
  23. digitalhub/context/api.py +0 -93
  24. digitalhub/context/builder.py +0 -94
  25. digitalhub/context/context.py +0 -136
  26. digitalhub/datastores/__init__.py +0 -0
  27. digitalhub/datastores/_base/__init__.py +0 -0
  28. digitalhub/datastores/_base/datastore.py +0 -85
  29. digitalhub/datastores/api.py +0 -37
  30. digitalhub/datastores/builder.py +0 -110
  31. digitalhub/datastores/local/__init__.py +0 -0
  32. digitalhub/datastores/local/datastore.py +0 -50
  33. digitalhub/datastores/remote/__init__.py +0 -0
  34. digitalhub/datastores/remote/datastore.py +0 -31
  35. digitalhub/datastores/s3/__init__.py +0 -0
  36. digitalhub/datastores/s3/datastore.py +0 -46
  37. digitalhub/datastores/sql/__init__.py +0 -0
  38. digitalhub/datastores/sql/datastore.py +0 -68
  39. digitalhub/entities/__init__.py +0 -0
  40. digitalhub/entities/_base/__init__.py +0 -0
  41. digitalhub/entities/_base/_base/__init__.py +0 -0
  42. digitalhub/entities/_base/_base/entity.py +0 -82
  43. digitalhub/entities/_base/api_utils.py +0 -620
  44. digitalhub/entities/_base/context/__init__.py +0 -0
  45. digitalhub/entities/_base/context/entity.py +0 -118
  46. digitalhub/entities/_base/crud.py +0 -468
  47. digitalhub/entities/_base/entity/__init__.py +0 -0
  48. digitalhub/entities/_base/entity/_constructors/__init__.py +0 -0
  49. digitalhub/entities/_base/entity/_constructors/metadata.py +0 -44
  50. digitalhub/entities/_base/entity/_constructors/name.py +0 -31
  51. digitalhub/entities/_base/entity/_constructors/spec.py +0 -33
  52. digitalhub/entities/_base/entity/_constructors/status.py +0 -52
  53. digitalhub/entities/_base/entity/_constructors/uuid.py +0 -26
  54. digitalhub/entities/_base/entity/builder.py +0 -175
  55. digitalhub/entities/_base/entity/entity.py +0 -106
  56. digitalhub/entities/_base/entity/metadata.py +0 -59
  57. digitalhub/entities/_base/entity/spec.py +0 -58
  58. digitalhub/entities/_base/entity/status.py +0 -43
  59. digitalhub/entities/_base/executable/__init__.py +0 -0
  60. digitalhub/entities/_base/executable/entity.py +0 -405
  61. digitalhub/entities/_base/material/__init__.py +0 -0
  62. digitalhub/entities/_base/material/entity.py +0 -214
  63. digitalhub/entities/_base/material/spec.py +0 -22
  64. digitalhub/entities/_base/material/status.py +0 -49
  65. digitalhub/entities/_base/runtime_entity/__init__.py +0 -0
  66. digitalhub/entities/_base/runtime_entity/builder.py +0 -106
  67. digitalhub/entities/_base/unversioned/__init__.py +0 -0
  68. digitalhub/entities/_base/unversioned/builder.py +0 -66
  69. digitalhub/entities/_base/unversioned/entity.py +0 -49
  70. digitalhub/entities/_base/versioned/__init__.py +0 -0
  71. digitalhub/entities/_base/versioned/builder.py +0 -68
  72. digitalhub/entities/_base/versioned/entity.py +0 -53
  73. digitalhub/entities/artifact/__init__.py +0 -0
  74. digitalhub/entities/artifact/_base/__init__.py +0 -0
  75. digitalhub/entities/artifact/_base/builder.py +0 -86
  76. digitalhub/entities/artifact/_base/entity.py +0 -39
  77. digitalhub/entities/artifact/_base/spec.py +0 -15
  78. digitalhub/entities/artifact/_base/status.py +0 -9
  79. digitalhub/entities/artifact/artifact/__init__.py +0 -0
  80. digitalhub/entities/artifact/artifact/builder.py +0 -18
  81. digitalhub/entities/artifact/artifact/entity.py +0 -32
  82. digitalhub/entities/artifact/artifact/spec.py +0 -27
  83. digitalhub/entities/artifact/artifact/status.py +0 -15
  84. digitalhub/entities/artifact/crud.py +0 -332
  85. digitalhub/entities/builders.py +0 -63
  86. digitalhub/entities/dataitem/__init__.py +0 -0
  87. digitalhub/entities/dataitem/_base/__init__.py +0 -0
  88. digitalhub/entities/dataitem/_base/builder.py +0 -86
  89. digitalhub/entities/dataitem/_base/entity.py +0 -75
  90. digitalhub/entities/dataitem/_base/spec.py +0 -15
  91. digitalhub/entities/dataitem/_base/status.py +0 -20
  92. digitalhub/entities/dataitem/crud.py +0 -372
  93. digitalhub/entities/dataitem/dataitem/__init__.py +0 -0
  94. digitalhub/entities/dataitem/dataitem/builder.py +0 -18
  95. digitalhub/entities/dataitem/dataitem/entity.py +0 -32
  96. digitalhub/entities/dataitem/dataitem/spec.py +0 -15
  97. digitalhub/entities/dataitem/dataitem/status.py +0 -9
  98. digitalhub/entities/dataitem/iceberg/__init__.py +0 -0
  99. digitalhub/entities/dataitem/iceberg/builder.py +0 -18
  100. digitalhub/entities/dataitem/iceberg/entity.py +0 -32
  101. digitalhub/entities/dataitem/iceberg/spec.py +0 -15
  102. digitalhub/entities/dataitem/iceberg/status.py +0 -9
  103. digitalhub/entities/dataitem/table/__init__.py +0 -0
  104. digitalhub/entities/dataitem/table/builder.py +0 -18
  105. digitalhub/entities/dataitem/table/entity.py +0 -146
  106. digitalhub/entities/dataitem/table/models.py +0 -62
  107. digitalhub/entities/dataitem/table/spec.py +0 -25
  108. digitalhub/entities/dataitem/table/status.py +0 -9
  109. digitalhub/entities/function/__init__.py +0 -0
  110. digitalhub/entities/function/_base/__init__.py +0 -0
  111. digitalhub/entities/function/_base/builder.py +0 -79
  112. digitalhub/entities/function/_base/entity.py +0 -98
  113. digitalhub/entities/function/_base/models.py +0 -118
  114. digitalhub/entities/function/_base/spec.py +0 -15
  115. digitalhub/entities/function/_base/status.py +0 -9
  116. digitalhub/entities/function/crud.py +0 -279
  117. digitalhub/entities/model/__init__.py +0 -0
  118. digitalhub/entities/model/_base/__init__.py +0 -0
  119. digitalhub/entities/model/_base/builder.py +0 -86
  120. digitalhub/entities/model/_base/entity.py +0 -34
  121. digitalhub/entities/model/_base/spec.py +0 -49
  122. digitalhub/entities/model/_base/status.py +0 -9
  123. digitalhub/entities/model/crud.py +0 -331
  124. digitalhub/entities/model/huggingface/__init__.py +0 -0
  125. digitalhub/entities/model/huggingface/builder.py +0 -18
  126. digitalhub/entities/model/huggingface/entity.py +0 -32
  127. digitalhub/entities/model/huggingface/spec.py +0 -36
  128. digitalhub/entities/model/huggingface/status.py +0 -9
  129. digitalhub/entities/model/mlflow/__init__.py +0 -0
  130. digitalhub/entities/model/mlflow/builder.py +0 -18
  131. digitalhub/entities/model/mlflow/entity.py +0 -32
  132. digitalhub/entities/model/mlflow/models.py +0 -26
  133. digitalhub/entities/model/mlflow/spec.py +0 -44
  134. digitalhub/entities/model/mlflow/status.py +0 -9
  135. digitalhub/entities/model/mlflow/utils.py +0 -81
  136. digitalhub/entities/model/model/__init__.py +0 -0
  137. digitalhub/entities/model/model/builder.py +0 -18
  138. digitalhub/entities/model/model/entity.py +0 -32
  139. digitalhub/entities/model/model/spec.py +0 -15
  140. digitalhub/entities/model/model/status.py +0 -9
  141. digitalhub/entities/model/sklearn/__init__.py +0 -0
  142. digitalhub/entities/model/sklearn/builder.py +0 -18
  143. digitalhub/entities/model/sklearn/entity.py +0 -32
  144. digitalhub/entities/model/sklearn/spec.py +0 -15
  145. digitalhub/entities/model/sklearn/status.py +0 -9
  146. digitalhub/entities/project/__init__.py +0 -0
  147. digitalhub/entities/project/_base/__init__.py +0 -0
  148. digitalhub/entities/project/_base/builder.py +0 -128
  149. digitalhub/entities/project/_base/entity.py +0 -2078
  150. digitalhub/entities/project/_base/spec.py +0 -50
  151. digitalhub/entities/project/_base/status.py +0 -9
  152. digitalhub/entities/project/crud.py +0 -357
  153. digitalhub/entities/run/__init__.py +0 -0
  154. digitalhub/entities/run/_base/__init__.py +0 -0
  155. digitalhub/entities/run/_base/builder.py +0 -94
  156. digitalhub/entities/run/_base/entity.py +0 -307
  157. digitalhub/entities/run/_base/spec.py +0 -50
  158. digitalhub/entities/run/_base/status.py +0 -9
  159. digitalhub/entities/run/crud.py +0 -219
  160. digitalhub/entities/secret/__init__.py +0 -0
  161. digitalhub/entities/secret/_base/__init__.py +0 -0
  162. digitalhub/entities/secret/_base/builder.py +0 -81
  163. digitalhub/entities/secret/_base/entity.py +0 -74
  164. digitalhub/entities/secret/_base/spec.py +0 -35
  165. digitalhub/entities/secret/_base/status.py +0 -9
  166. digitalhub/entities/secret/crud.py +0 -290
  167. digitalhub/entities/task/__init__.py +0 -0
  168. digitalhub/entities/task/_base/__init__.py +0 -0
  169. digitalhub/entities/task/_base/builder.py +0 -91
  170. digitalhub/entities/task/_base/entity.py +0 -136
  171. digitalhub/entities/task/_base/models.py +0 -208
  172. digitalhub/entities/task/_base/spec.py +0 -53
  173. digitalhub/entities/task/_base/status.py +0 -9
  174. digitalhub/entities/task/crud.py +0 -228
  175. digitalhub/entities/utils/__init__.py +0 -0
  176. digitalhub/entities/utils/api.py +0 -346
  177. digitalhub/entities/utils/entity_types.py +0 -19
  178. digitalhub/entities/utils/state.py +0 -31
  179. digitalhub/entities/utils/utils.py +0 -202
  180. digitalhub/entities/workflow/__init__.py +0 -0
  181. digitalhub/entities/workflow/_base/__init__.py +0 -0
  182. digitalhub/entities/workflow/_base/builder.py +0 -79
  183. digitalhub/entities/workflow/_base/entity.py +0 -74
  184. digitalhub/entities/workflow/_base/spec.py +0 -15
  185. digitalhub/entities/workflow/_base/status.py +0 -9
  186. digitalhub/entities/workflow/crud.py +0 -278
  187. digitalhub/factory/__init__.py +0 -0
  188. digitalhub/factory/api.py +0 -277
  189. digitalhub/factory/factory.py +0 -268
  190. digitalhub/factory/utils.py +0 -90
  191. digitalhub/readers/__init__.py +0 -0
  192. digitalhub/readers/_base/__init__.py +0 -0
  193. digitalhub/readers/_base/builder.py +0 -26
  194. digitalhub/readers/_base/reader.py +0 -70
  195. digitalhub/readers/api.py +0 -80
  196. digitalhub/readers/factory.py +0 -133
  197. digitalhub/readers/pandas/__init__.py +0 -0
  198. digitalhub/readers/pandas/builder.py +0 -29
  199. digitalhub/readers/pandas/reader.py +0 -207
  200. digitalhub/runtimes/__init__.py +0 -0
  201. digitalhub/runtimes/_base.py +0 -102
  202. digitalhub/runtimes/builder.py +0 -32
  203. digitalhub/stores/__init__.py +0 -0
  204. digitalhub/stores/_base/__init__.py +0 -0
  205. digitalhub/stores/_base/store.py +0 -189
  206. digitalhub/stores/api.py +0 -54
  207. digitalhub/stores/builder.py +0 -211
  208. digitalhub/stores/local/__init__.py +0 -0
  209. digitalhub/stores/local/store.py +0 -230
  210. digitalhub/stores/remote/__init__.py +0 -0
  211. digitalhub/stores/remote/store.py +0 -143
  212. digitalhub/stores/s3/__init__.py +0 -0
  213. digitalhub/stores/s3/store.py +0 -563
  214. digitalhub/stores/sql/__init__.py +0 -0
  215. digitalhub/stores/sql/store.py +0 -328
  216. digitalhub/utils/__init__.py +0 -0
  217. digitalhub/utils/data_utils.py +0 -127
  218. digitalhub/utils/exceptions.py +0 -67
  219. digitalhub/utils/file_utils.py +0 -204
  220. digitalhub/utils/generic_utils.py +0 -183
  221. digitalhub/utils/git_utils.py +0 -148
  222. digitalhub/utils/io_utils.py +0 -116
  223. digitalhub/utils/logger.py +0 -17
  224. digitalhub/utils/s3_utils.py +0 -58
  225. digitalhub/utils/uri_utils.py +0 -56
  226. digitalhub-0.8.0.dist-info/RECORD +0 -231
  227. test/local/CRUD/test_artifacts.py +0 -96
  228. test/local/CRUD/test_dataitems.py +0 -96
  229. test/local/CRUD/test_models.py +0 -95
  230. {digitalhub-0.8.0.dist-info → digitalhub-0.8.0b0.dist-info}/LICENSE.txt +0 -0
  231. {digitalhub-0.8.0.dist-info → digitalhub-0.8.0b0.dist-info}/top_level.txt +0 -0
  232. /test/{local/imports/test_imports.py → test_imports.py} +0 -0
digitalhub/__init__.py CHANGED
@@ -1,82 +1,113 @@
1
- from digitalhub.entities.artifact.crud import (
1
+ from digitalhub_core import (
2
2
  delete_artifact,
3
+ delete_function,
4
+ delete_project,
5
+ delete_run,
6
+ delete_secret,
7
+ delete_task,
8
+ delete_workflow,
3
9
  get_artifact,
4
10
  get_artifact_versions,
5
- import_artifact,
6
- list_artifacts,
7
- log_artifact,
8
- new_artifact,
9
- update_artifact,
10
- )
11
- from digitalhub.entities.dataitem.crud import (
12
- delete_dataitem,
13
- get_dataitem,
14
- get_dataitem_versions,
15
- import_dataitem,
16
- list_dataitems,
17
- log_dataitem,
18
- new_dataitem,
19
- update_dataitem,
20
- )
21
- from digitalhub.entities.function.crud import (
22
- delete_function,
23
11
  get_function,
24
12
  get_function_versions,
25
- import_function,
26
- list_functions,
27
- new_function,
28
- update_function,
29
- )
30
- from digitalhub.entities.model.crud import (
31
- delete_model,
32
- get_model,
33
- get_model_versions,
34
- import_model,
35
- list_models,
36
- log_model,
37
- new_model,
38
- update_model,
39
- )
40
- from digitalhub.entities.project.crud import (
41
- delete_project,
42
- get_or_create_project,
43
- get_project,
44
- import_project,
45
- load_project,
46
- new_project,
47
- update_project,
48
- )
49
- from digitalhub.entities.run.crud import delete_run, get_run, import_run, list_runs, new_run, update_run
50
- from digitalhub.entities.secret.crud import (
51
- delete_secret,
13
+ get_run,
52
14
  get_secret,
53
15
  get_secret_versions,
54
- import_secret,
55
- list_secrets,
56
- new_secret,
57
- update_secret,
58
- )
59
- from digitalhub.entities.task.crud import delete_task, get_task, import_task, list_tasks, new_task, update_task
60
- from digitalhub.entities.workflow.crud import (
61
- delete_workflow,
16
+ get_task,
62
17
  get_workflow,
63
18
  get_workflow_versions,
19
+ import_artifact,
20
+ import_function,
21
+ import_run,
22
+ import_secret,
23
+ import_task,
64
24
  import_workflow,
25
+ list_artifacts,
26
+ list_functions,
27
+ list_runs,
28
+ list_secrets,
29
+ list_tasks,
65
30
  list_workflows,
31
+ log_artifact,
32
+ new_artifact,
33
+ new_function,
34
+ new_run,
35
+ new_secret,
36
+ new_task,
66
37
  new_workflow,
38
+ refresh_token,
39
+ set_dhcore_env,
40
+ set_store,
41
+ update_artifact,
42
+ update_function,
43
+ update_project,
44
+ update_run,
45
+ update_secret,
46
+ update_task,
67
47
  update_workflow,
68
48
  )
49
+ from digitalhub_core.registry.utils import register_layer_entities, register_runtimes_entities
69
50
 
70
- try:
71
- from digitalhub.entities.model.mlflow.utils import from_mlflow_run
72
- except ImportError:
73
- ...
51
+ _PROJECT_IMPORTED = False
74
52
 
75
- from digitalhub.client.dhcore.utils import refresh_token, set_dhcore_env
53
+ if not _PROJECT_IMPORTED:
54
+ try:
55
+ from digitalhub_data import (
56
+ delete_dataitem,
57
+ get_dataitem,
58
+ get_dataitem_versions,
59
+ import_dataitem,
60
+ list_dataitems,
61
+ log_dataitem,
62
+ new_dataitem,
63
+ update_dataitem,
64
+ )
65
+ from digitalhub_ml import (
66
+ delete_model,
67
+ get_model,
68
+ get_model_versions,
69
+ get_or_create_project,
70
+ get_project,
71
+ import_model,
72
+ import_project,
73
+ list_models,
74
+ load_project,
75
+ log_model,
76
+ new_model,
77
+ new_project,
78
+ update_model,
79
+ )
76
80
 
77
- # Register entities into registry
78
- from digitalhub.factory.utils import register_entities, register_runtimes_entities
79
- from digitalhub.stores.api import set_store
81
+ _PROJECT_IMPORTED = True
82
+ except ImportError:
83
+ ...
84
+
85
+ if not _PROJECT_IMPORTED:
86
+ try:
87
+ from digitalhub_data import (
88
+ delete_dataitem,
89
+ get_dataitem,
90
+ get_dataitem_versions,
91
+ get_or_create_project,
92
+ get_project,
93
+ import_dataitem,
94
+ import_project,
95
+ list_dataitems,
96
+ load_project,
97
+ log_dataitem,
98
+ new_dataitem,
99
+ new_project,
100
+ update_dataitem,
101
+ )
102
+
103
+ _PROJECT_IMPORTED = True
104
+ except ImportError:
105
+ ...
80
106
 
81
- register_entities()
107
+ if not _PROJECT_IMPORTED:
108
+ from digitalhub_core import get_or_create_project, get_project, import_project, load_project, new_project
109
+
110
+
111
+ # Register entities into registry
112
+ register_layer_entities()
82
113
  register_runtimes_entities()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: digitalhub
3
- Version: 0.8.0
3
+ Version: 0.8.0b0
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
@@ -229,38 +229,22 @@ Classifier: Programming Language :: Python :: 3.11
229
229
  Requires-Python: >=3.9
230
230
  Description-Content-Type: text/markdown
231
231
  License-File: LICENSE.txt
232
- Requires-Dist: boto3
233
- Requires-Dist: pydantic<2
234
- Requires-Dist: sqlalchemy<2
235
- Requires-Dist: pyarrow
236
- Requires-Dist: numpy<2
237
- Requires-Dist: requests
238
- Requires-Dist: PyYAML
239
- Requires-Dist: python-dotenv
240
- Requires-Dist: GitPython>=3
241
- Requires-Dist: psycopg2-binary
242
- Requires-Dist: python-slugify
243
- Provides-Extra: dev
244
- Requires-Dist: black; extra == "dev"
245
- Requires-Dist: pytest; extra == "dev"
246
- Requires-Dist: bumpver; extra == "dev"
247
- Requires-Dist: ruff; extra == "dev"
248
- Requires-Dist: moto; extra == "dev"
249
- Provides-Extra: docs
250
- Requires-Dist: Sphinx>=7; extra == "docs"
251
- Requires-Dist: pydata-sphinx-theme>=0.15; extra == "docs"
252
- Requires-Dist: numpydoc>=1.6; extra == "docs"
232
+ Requires-Dist: digitalhub-core<0.9,>=0.8.0b
233
+ Provides-Extra: all
234
+ Requires-Dist: digitalhub-data<0.9,>=0.8.0b; extra == "all"
235
+ Requires-Dist: digitalhub-ml<0.9,>=0.8.0b; extra == "all"
236
+ Provides-Extra: data
237
+ Requires-Dist: digitalhub-data<0.9,>=0.8.0b; extra == "data"
253
238
  Provides-Extra: full
254
- Requires-Dist: pandas<2.2,>=1.2; extra == "full"
255
- Requires-Dist: mlflow; extra == "full"
256
- Provides-Extra: mlflow
257
- Requires-Dist: mlflow; extra == "mlflow"
258
- Provides-Extra: pandas
259
- Requires-Dist: pandas<2.2,>=1.2; extra == "pandas"
239
+ Requires-Dist: digitalhub-core[full]<0.9,>=0.8.0b; extra == "full"
240
+ Requires-Dist: digitalhub-data[pandas]<0.9,>=0.8.0b; extra == "full"
241
+ Requires-Dist: digitalhub-ml[mlflow]<0.9,>=0.8.0b; extra == "full"
242
+ Provides-Extra: ml
243
+ Requires-Dist: digitalhub-ml<0.9,>=0.8.0b; extra == "ml"
260
244
 
261
245
  # Digitalhub Library
262
246
 
263
247
  The Digitalhub SDK library is used to manage entities and executions in Digitalhub from Python.
264
248
  It comes with a suite of tools to help you manage your projects and executions. It exposes CRUD methods to create, read, update and delete entities, and objects methods to excute functions or workflows, collect or store execution results and data.
265
249
 
266
- A more detailed description of the library can be found in the [official documentation](https://scc-digitalhub.github.io/sdk-docs/).
250
+ A more detailed description of the library can be found in the [official documentation](https://scc-digitalhub.github.io/docs/) of Digitalhub.
@@ -0,0 +1,14 @@
1
+ digitalhub/__init__.py,sha256=vvMeyMD5146sLRNYs6EQuUiN5D4O8cO0XfS8r-W5OuM,2540
2
+ test/test_crud_artifacts.py,sha256=CgPUAYRWurWWH1eRwGJp_6iiulGLy4bOPccvC3XqSCc,2489
3
+ test/test_crud_dataitems.py,sha256=jj15NUUyAAfOCYZEfZOxEq9f5s2_T3dVdfJ7agL50tc,2489
4
+ test/test_crud_functions.py,sha256=zihCaqWUps-Cm14BkCr5qHoOubeZPOn7TyKi49DSkE4,2768
5
+ test/test_crud_runs.py,sha256=MIOgrgEa6gdwoS6rhdOkPderZcQrdZXMptCV0w3f6-k,2219
6
+ test/test_crud_tasks.py,sha256=LLFf6teU64YF8m-gS02tyEoi_eHZmHw6OmO4yhe3Wqo,2110
7
+ test/test_imports.py,sha256=W-YugO0rpJwvtWp57MXaXfEmE-f5iWuCiLY-n0ZU4z8,1271
8
+ test/testkfp.py,sha256=01UpLKkVbwAQu4S1BMiddnnq5x1DStMlJtCoHzi9zq8,1060
9
+ test/testkfp_pipeline.py,sha256=WceFrCp-avHI7PcwIvnv7Kgs2xK3oQqU6sjaonGamg8,622
10
+ digitalhub-0.8.0b0.dist-info/LICENSE.txt,sha256=_yVOtnbW7Ss28mp058UEEc1X4Rgj8-kQBP_kj8_Sc88,11585
11
+ digitalhub-0.8.0b0.dist-info/METADATA,sha256=eZulZbNOcPcv3r2TmQROJEw8W7hde6umDPuH_4m3Mp4,14957
12
+ digitalhub-0.8.0b0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
13
+ digitalhub-0.8.0b0.dist-info/top_level.txt,sha256=ae9pDfCF27ZoaVAxuBKONMP0lm5P-N_I-e-no1WlvD8,16
14
+ digitalhub-0.8.0b0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1,96 @@
1
+ import shutil
2
+ from copy import deepcopy
3
+
4
+ import dotenv
5
+ from digitalhub_core.entities.artifact.entity._base import Artifact
6
+
7
+ import digitalhub as dh
8
+
9
+ dotenv.load_dotenv()
10
+
11
+
12
+ def main():
13
+ ctx = "./test-prg"
14
+ names = ["test1", "test2", "test3", "test4"]
15
+ uuids = [
16
+ "d150bcca-bb64-451d-8455-dff862254b95",
17
+ "31acdd2d-0c41-428c-b68b-1b133da9e97b",
18
+ "b4a3dfdc-b917-44c4-9a29-613dcf734244",
19
+ "2618d9c4-cd61-440f-aebb-7e5761709f3b",
20
+ ]
21
+ paths = ["./data/test.csv", "s3://bucket/key.csv", "sql://database/schema/table", "https://url.com/file.csv"]
22
+ kind = ["artifact", "artifact", "artifact", "artifact"]
23
+
24
+ dicts = []
25
+ for i in range(len(names)):
26
+ dicts.append({"name": names[i], "uuid": uuids[i], "path": paths[i], "kind": kind[i]})
27
+
28
+ dh.delete_project("test")
29
+
30
+ p = dh.get_or_create_project("test", context=ctx)
31
+
32
+ # Create and delete artifacts
33
+ for i in dicts:
34
+ d = dh.new_artifact(p.name, **i)
35
+ dh.delete_artifact(d.key)
36
+ d = dh.new_artifact(p.name, **i)
37
+ dh.delete_artifact(d.name, project=p.name, entity_id=d.id)
38
+ d = p.new_artifact(**i)
39
+ p.delete_artifact(d.key)
40
+
41
+ print("Done 1")
42
+
43
+ # Create multiple artifacts
44
+ for i in dicts:
45
+ dh.new_artifact(p.name, **i)
46
+
47
+ c = deepcopy(i)
48
+ c.pop("uuid")
49
+ dh.new_artifact(p.name, **c)
50
+ dh.new_artifact(p.name, **c)
51
+ dh.new_artifact(p.name, **c)
52
+ dh.new_artifact(p.name, **c)
53
+
54
+ # List artifacts
55
+ l_obj = dh.list_artifacts(p.name)
56
+ assert isinstance(l_obj, list)
57
+ assert len(l_obj) == 4
58
+ for i in l_obj:
59
+ assert isinstance(i, Artifact)
60
+
61
+ for a in l_obj:
62
+ dh.delete_artifact(a.key)
63
+
64
+ print("Done 2")
65
+
66
+ # Get artifacts test
67
+ for i in dicts:
68
+ o1 = dh.new_artifact(p.name, **i)
69
+ assert isinstance(o1, Artifact)
70
+
71
+ # Get by name and id
72
+ o2 = dh.get_artifact(o1.name, project=p.name, entity_id=o1.id)
73
+ assert isinstance(o2, Artifact)
74
+ assert o1.id == o2.id
75
+
76
+ # Get by key
77
+ o3 = dh.get_artifact(o1.key)
78
+ assert isinstance(o3, Artifact)
79
+ assert o1.id == o3.id
80
+
81
+ print("Done 3")
82
+
83
+ # Delete artifacts, all versions
84
+ for n in names:
85
+ dh.delete_artifact(n, project=p.name, delete_all_versions=True)
86
+ l_obj = dh.list_artifacts(p.name)
87
+ assert not l_obj
88
+
89
+ dh.delete_project("test")
90
+ shutil.rmtree(ctx)
91
+
92
+ print("Done 4")
93
+
94
+
95
+ if __name__ == "__main__":
96
+ main()
@@ -0,0 +1,96 @@
1
+ import shutil
2
+ from copy import deepcopy
3
+
4
+ import dotenv
5
+ from digitalhub_data.entities.dataitem.entity._base import Dataitem
6
+
7
+ import digitalhub as dh
8
+
9
+ dotenv.load_dotenv()
10
+
11
+
12
+ def main():
13
+ ctx = "./test-prg"
14
+ names = ["test1", "test2", "test3", "test4"]
15
+ uuids = [
16
+ "d150bcca-bb64-451d-8455-dff862254b95",
17
+ "31acdd2d-0c41-428c-b68b-1b133da9e97b",
18
+ "b4a3dfdc-b917-44c4-9a29-613dcf734244",
19
+ "2618d9c4-cd61-440f-aebb-7e5761709f3b",
20
+ ]
21
+ paths = ["./data/test.csv", "s3://bucket/key.csv", "sql://database/schema/table", "https://url.com/file.csv"]
22
+ kind = ["dataitem", "dataitem", "dataitem", "dataitem"]
23
+
24
+ dicts = []
25
+ for i in range(len(names)):
26
+ dicts.append({"name": names[i], "uuid": uuids[i], "path": paths[i], "kind": kind[i]})
27
+
28
+ dh.delete_project("test")
29
+
30
+ p = dh.get_or_create_project("test", context=ctx)
31
+
32
+ # Create and delete dataitems
33
+ for i in dicts:
34
+ d = dh.new_dataitem(p.name, **i)
35
+ dh.delete_dataitem(d.key)
36
+ d = dh.new_dataitem(p.name, **i)
37
+ dh.delete_dataitem(d.name, project=p.name, entity_id=d.id)
38
+ d = p.new_dataitem(**i)
39
+ p.delete_dataitem(d.key)
40
+
41
+ print("Done 1")
42
+
43
+ # Create multiple dataitems
44
+ for i in dicts:
45
+ dh.new_dataitem(p.name, **i)
46
+
47
+ c = deepcopy(i)
48
+ c.pop("uuid")
49
+ dh.new_dataitem(p.name, **c)
50
+ dh.new_dataitem(p.name, **c)
51
+ dh.new_dataitem(p.name, **c)
52
+ dh.new_dataitem(p.name, **c)
53
+
54
+ # List dataitems
55
+ l_obj = dh.list_dataitems(p.name)
56
+ assert isinstance(l_obj, list)
57
+ assert len(l_obj) == 4
58
+ for i in l_obj:
59
+ assert isinstance(i, Dataitem)
60
+
61
+ for a in l_obj:
62
+ dh.delete_dataitem(a.key)
63
+
64
+ print("Done 2")
65
+
66
+ # Get dataitems test
67
+ for i in dicts:
68
+ o1 = dh.new_dataitem(p.name, **i)
69
+ assert isinstance(o1, Dataitem)
70
+
71
+ # Get by name and id
72
+ o2 = dh.get_dataitem(o1.name, project=p.name, entity_id=o1.id)
73
+ assert isinstance(o2, Dataitem)
74
+ assert o1.id == o2.id
75
+
76
+ # Get by key
77
+ o3 = dh.get_dataitem(o1.key)
78
+ assert isinstance(o3, Dataitem)
79
+ assert o1.id == o3.id
80
+
81
+ print("Done 3")
82
+
83
+ # Delete dataitems, all versions
84
+ for n in names:
85
+ dh.delete_dataitem(n, project=p.name, delete_all_versions=True)
86
+ l_obj = dh.list_dataitems(p.name)
87
+ assert not l_obj
88
+
89
+ dh.delete_project("test")
90
+ shutil.rmtree(ctx)
91
+
92
+ print("Done 4")
93
+
94
+
95
+ if __name__ == "__main__":
96
+ main()
@@ -1,9 +1,9 @@
1
1
  from copy import deepcopy
2
2
 
3
3
  import dotenv
4
+ from digitalhub_core.entities.function.entity import Function
4
5
 
5
6
  import digitalhub
6
- from digitalhub.entities.function._base.entity import Function
7
7
 
8
8
  dotenv.load_dotenv()
9
9
 
test/test_crud_runs.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import dotenv
2
+ from digitalhub_core.entities.run.entity import Run
2
3
 
3
4
  import digitalhub
4
- from digitalhub.entities.run._base.entity import Run
5
5
 
6
6
  dotenv.load_dotenv()
7
7
 
test/test_crud_tasks.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import dotenv
2
+ from digitalhub_core.entities.task.entity import Task
2
3
 
3
4
  import digitalhub
4
- from digitalhub.entities.task._base.entity import Task
5
5
 
6
6
  dotenv.load_dotenv()
7
7
 
File without changes
File without changes
@@ -1,56 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from abc import abstractmethod
4
-
5
-
6
- class Client:
7
- """
8
- Base Client class interface.
9
-
10
- The client is an interface that handles the CRUD of an object during
11
- a session. It manages the creation, reading, updating, deleting and
12
- listing of objects and comes into two subclasses: Local and DHCore.
13
- """
14
-
15
- @abstractmethod
16
- def create_object(self, api: str, obj: dict, **kwargs) -> dict:
17
- """
18
- Create object method.
19
- """
20
-
21
- @abstractmethod
22
- def read_object(self, api: str, **kwargs) -> dict:
23
- """
24
- Read object method.
25
- """
26
-
27
- @abstractmethod
28
- def update_object(self, api: str, obj: dict, **kwargs) -> dict:
29
- """
30
- Update object method.
31
- """
32
-
33
- @abstractmethod
34
- def delete_object(self, api: str, **kwargs) -> dict:
35
- """
36
- Delete object method.
37
- """
38
-
39
- @abstractmethod
40
- def list_objects(self, api: str, **kwargs) -> dict:
41
- """
42
- List objects method.
43
- """
44
-
45
- @abstractmethod
46
- def list_first_object(self, api: str, **kwargs) -> dict:
47
- """
48
- Read first object method.
49
- """
50
-
51
- @staticmethod
52
- @abstractmethod
53
- def is_local() -> bool:
54
- """
55
- Flag to check if client is local.
56
- """
digitalhub/client/api.py DELETED
@@ -1,63 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import typing
4
-
5
- from digitalhub.client.builder import client_builder
6
-
7
- if typing.TYPE_CHECKING:
8
- from digitalhub.client._base.client import Client
9
-
10
-
11
- def check_client_exists(local: bool = False) -> bool:
12
- """
13
- Check if client exists.
14
-
15
- Parameters
16
- ----------
17
- local : bool
18
- Check client existence by local.
19
-
20
- Returns
21
- -------
22
- bool
23
- True if client exists, False otherwise.
24
- """
25
- if local:
26
- return client_builder._local is not None
27
- return client_builder._dhcore is not None
28
-
29
-
30
- def build_client(local: bool = False, config: dict | None = None) -> None:
31
- """
32
- Wrapper around ClientBuilder.build.
33
-
34
- Parameters
35
- ----------
36
- local : bool
37
- Whether to create a local client or not.
38
- config : dict
39
- DHCore environment configuration.
40
-
41
- Returns
42
- -------
43
- Client
44
- The client instance.
45
- """
46
- client_builder.build(local, config)
47
-
48
-
49
- def get_client(local: bool = False) -> Client:
50
- """
51
- Wrapper around ClientBuilder.build.
52
-
53
- Parameters
54
- ----------
55
- local : bool
56
- Whether to create a local client or not.
57
-
58
- Returns
59
- -------
60
- Client
61
- The client instance.
62
- """
63
- return client_builder.build(local)
@@ -1,50 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import typing
4
-
5
- from digitalhub.client.dhcore.client import ClientDHCore
6
- from digitalhub.client.local.client import ClientLocal
7
-
8
- if typing.TYPE_CHECKING:
9
- from digitalhub.client._base.client import Client
10
-
11
-
12
- class ClientBuilder:
13
- """
14
- Client builder class.
15
-
16
- This class is used to create two possible client instances:
17
- Local and DHCore.
18
- It saves the client instances in the class attributes using
19
- singleton pattern.
20
- """
21
-
22
- def __init__(self) -> None:
23
- self._local = None
24
- self._dhcore = None
25
-
26
- def build(self, local: bool = False, config: dict | None = None) -> Client:
27
- """
28
- Method to create a client instance.
29
-
30
- Parameters
31
- ----------
32
- local : bool
33
- Whether to create a local client or not.
34
-
35
- Returns
36
- -------
37
- Client
38
- Returns the client instance.
39
- """
40
- if local:
41
- if self._local is None:
42
- self._local = ClientLocal()
43
- return self._local
44
-
45
- if self._dhcore is None:
46
- self._dhcore = ClientDHCore(config)
47
- return self._dhcore
48
-
49
-
50
- client_builder = ClientBuilder()
File without changes