digitalhub 0.8.0b0__py3-none-any.whl → 0.8.0b2__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 (159) hide show
  1. digitalhub/__init__.py +62 -94
  2. digitalhub/client/__init__.py +0 -0
  3. digitalhub/client/builder.py +105 -0
  4. digitalhub/client/objects/__init__.py +0 -0
  5. digitalhub/client/objects/base.py +56 -0
  6. digitalhub/client/objects/dhcore.py +681 -0
  7. digitalhub/client/objects/local.py +533 -0
  8. digitalhub/context/__init__.py +0 -0
  9. digitalhub/context/builder.py +178 -0
  10. digitalhub/context/context.py +136 -0
  11. digitalhub/datastores/__init__.py +0 -0
  12. digitalhub/datastores/builder.py +134 -0
  13. digitalhub/datastores/objects/__init__.py +0 -0
  14. digitalhub/datastores/objects/base.py +85 -0
  15. digitalhub/datastores/objects/local.py +42 -0
  16. digitalhub/datastores/objects/remote.py +23 -0
  17. digitalhub/datastores/objects/s3.py +38 -0
  18. digitalhub/datastores/objects/sql.py +60 -0
  19. digitalhub/entities/__init__.py +0 -0
  20. digitalhub/entities/_base/__init__.py +0 -0
  21. digitalhub/entities/_base/api.py +346 -0
  22. digitalhub/entities/_base/base.py +82 -0
  23. digitalhub/entities/_base/crud.py +610 -0
  24. digitalhub/entities/_base/entity/__init__.py +0 -0
  25. digitalhub/entities/_base/entity/base.py +132 -0
  26. digitalhub/entities/_base/entity/context.py +118 -0
  27. digitalhub/entities/_base/entity/executable.py +380 -0
  28. digitalhub/entities/_base/entity/material.py +214 -0
  29. digitalhub/entities/_base/entity/unversioned.py +87 -0
  30. digitalhub/entities/_base/entity/versioned.py +94 -0
  31. digitalhub/entities/_base/metadata.py +59 -0
  32. digitalhub/entities/_base/spec/__init__.py +0 -0
  33. digitalhub/entities/_base/spec/base.py +58 -0
  34. digitalhub/entities/_base/spec/material.py +22 -0
  35. digitalhub/entities/_base/state.py +31 -0
  36. digitalhub/entities/_base/status/__init__.py +0 -0
  37. digitalhub/entities/_base/status/base.py +32 -0
  38. digitalhub/entities/_base/status/material.py +49 -0
  39. digitalhub/entities/_builders/__init__.py +0 -0
  40. digitalhub/entities/_builders/metadata.py +60 -0
  41. digitalhub/entities/_builders/name.py +31 -0
  42. digitalhub/entities/_builders/spec.py +43 -0
  43. digitalhub/entities/_builders/status.py +62 -0
  44. digitalhub/entities/_builders/uuid.py +33 -0
  45. digitalhub/entities/artifact/__init__.py +0 -0
  46. digitalhub/entities/artifact/builder.py +133 -0
  47. digitalhub/entities/artifact/crud.py +358 -0
  48. digitalhub/entities/artifact/entity/__init__.py +0 -0
  49. digitalhub/entities/artifact/entity/_base.py +39 -0
  50. digitalhub/entities/artifact/entity/artifact.py +9 -0
  51. digitalhub/entities/artifact/spec.py +39 -0
  52. digitalhub/entities/artifact/status.py +15 -0
  53. digitalhub/entities/dataitem/__init__.py +0 -0
  54. digitalhub/entities/dataitem/builder.py +144 -0
  55. digitalhub/entities/dataitem/crud.py +395 -0
  56. digitalhub/entities/dataitem/entity/__init__.py +0 -0
  57. digitalhub/entities/dataitem/entity/_base.py +75 -0
  58. digitalhub/entities/dataitem/entity/dataitem.py +9 -0
  59. digitalhub/entities/dataitem/entity/iceberg.py +7 -0
  60. digitalhub/entities/dataitem/entity/table.py +125 -0
  61. digitalhub/entities/dataitem/models.py +62 -0
  62. digitalhub/entities/dataitem/spec.py +61 -0
  63. digitalhub/entities/dataitem/status.py +38 -0
  64. digitalhub/entities/entity_types.py +19 -0
  65. digitalhub/entities/function/__init__.py +0 -0
  66. digitalhub/entities/function/builder.py +86 -0
  67. digitalhub/entities/function/crud.py +305 -0
  68. digitalhub/entities/function/entity.py +101 -0
  69. digitalhub/entities/function/models.py +118 -0
  70. digitalhub/entities/function/spec.py +81 -0
  71. digitalhub/entities/function/status.py +9 -0
  72. digitalhub/entities/model/__init__.py +0 -0
  73. digitalhub/entities/model/builder.py +152 -0
  74. digitalhub/entities/model/crud.py +358 -0
  75. digitalhub/entities/model/entity/__init__.py +0 -0
  76. digitalhub/entities/model/entity/_base.py +34 -0
  77. digitalhub/entities/model/entity/huggingface.py +9 -0
  78. digitalhub/entities/model/entity/mlflow.py +90 -0
  79. digitalhub/entities/model/entity/model.py +9 -0
  80. digitalhub/entities/model/entity/sklearn.py +9 -0
  81. digitalhub/entities/model/models.py +26 -0
  82. digitalhub/entities/model/spec.py +146 -0
  83. digitalhub/entities/model/status.py +33 -0
  84. digitalhub/entities/project/__init__.py +0 -0
  85. digitalhub/entities/project/builder.py +82 -0
  86. digitalhub/entities/project/crud.py +350 -0
  87. digitalhub/entities/project/entity.py +2060 -0
  88. digitalhub/entities/project/spec.py +50 -0
  89. digitalhub/entities/project/status.py +9 -0
  90. digitalhub/entities/registries.py +48 -0
  91. digitalhub/entities/run/__init__.py +0 -0
  92. digitalhub/entities/run/builder.py +77 -0
  93. digitalhub/entities/run/crud.py +232 -0
  94. digitalhub/entities/run/entity.py +461 -0
  95. digitalhub/entities/run/spec.py +153 -0
  96. digitalhub/entities/run/status.py +114 -0
  97. digitalhub/entities/secret/__init__.py +0 -0
  98. digitalhub/entities/secret/builder.py +93 -0
  99. digitalhub/entities/secret/crud.py +294 -0
  100. digitalhub/entities/secret/entity.py +73 -0
  101. digitalhub/entities/secret/spec.py +35 -0
  102. digitalhub/entities/secret/status.py +9 -0
  103. digitalhub/entities/task/__init__.py +0 -0
  104. digitalhub/entities/task/builder.py +74 -0
  105. digitalhub/entities/task/crud.py +241 -0
  106. digitalhub/entities/task/entity.py +135 -0
  107. digitalhub/entities/task/models.py +199 -0
  108. digitalhub/entities/task/spec.py +51 -0
  109. digitalhub/entities/task/status.py +9 -0
  110. digitalhub/entities/utils.py +184 -0
  111. digitalhub/entities/workflow/__init__.py +0 -0
  112. digitalhub/entities/workflow/builder.py +91 -0
  113. digitalhub/entities/workflow/crud.py +304 -0
  114. digitalhub/entities/workflow/entity.py +77 -0
  115. digitalhub/entities/workflow/spec.py +15 -0
  116. digitalhub/entities/workflow/status.py +9 -0
  117. digitalhub/readers/__init__.py +0 -0
  118. digitalhub/readers/builder.py +54 -0
  119. digitalhub/readers/objects/__init__.py +0 -0
  120. digitalhub/readers/objects/base.py +70 -0
  121. digitalhub/readers/objects/pandas.py +207 -0
  122. digitalhub/readers/registry.py +15 -0
  123. digitalhub/registry/__init__.py +0 -0
  124. digitalhub/registry/models.py +87 -0
  125. digitalhub/registry/registry.py +74 -0
  126. digitalhub/registry/utils.py +150 -0
  127. digitalhub/runtimes/__init__.py +0 -0
  128. digitalhub/runtimes/base.py +164 -0
  129. digitalhub/runtimes/builder.py +53 -0
  130. digitalhub/runtimes/kind_registry.py +170 -0
  131. digitalhub/stores/__init__.py +0 -0
  132. digitalhub/stores/builder.py +257 -0
  133. digitalhub/stores/objects/__init__.py +0 -0
  134. digitalhub/stores/objects/base.py +189 -0
  135. digitalhub/stores/objects/local.py +230 -0
  136. digitalhub/stores/objects/remote.py +143 -0
  137. digitalhub/stores/objects/s3.py +563 -0
  138. digitalhub/stores/objects/sql.py +328 -0
  139. digitalhub/utils/__init__.py +0 -0
  140. digitalhub/utils/data_utils.py +127 -0
  141. digitalhub/utils/env_utils.py +123 -0
  142. digitalhub/utils/exceptions.py +55 -0
  143. digitalhub/utils/file_utils.py +204 -0
  144. digitalhub/utils/generic_utils.py +207 -0
  145. digitalhub/utils/git_utils.py +148 -0
  146. digitalhub/utils/io_utils.py +79 -0
  147. digitalhub/utils/logger.py +17 -0
  148. digitalhub/utils/uri_utils.py +56 -0
  149. {digitalhub-0.8.0b0.dist-info → digitalhub-0.8.0b2.dist-info}/METADATA +27 -12
  150. digitalhub-0.8.0b2.dist-info/RECORD +161 -0
  151. test/test_crud_artifacts.py +1 -1
  152. test/test_crud_dataitems.py +1 -1
  153. test/test_crud_functions.py +1 -1
  154. test/test_crud_runs.py +1 -1
  155. test/test_crud_tasks.py +1 -1
  156. digitalhub-0.8.0b0.dist-info/RECORD +0 -14
  157. {digitalhub-0.8.0b0.dist-info → digitalhub-0.8.0b2.dist-info}/LICENSE.txt +0 -0
  158. {digitalhub-0.8.0b0.dist-info → digitalhub-0.8.0b2.dist-info}/WHEEL +0 -0
  159. {digitalhub-0.8.0b0.dist-info → digitalhub-0.8.0b2.dist-info}/top_level.txt +0 -0
digitalhub/__init__.py CHANGED
@@ -1,113 +1,81 @@
1
- from digitalhub_core import (
1
+ from digitalhub.entities.artifact.crud import (
2
2
  delete_artifact,
3
- delete_function,
4
- delete_project,
5
- delete_run,
6
- delete_secret,
7
- delete_task,
8
- delete_workflow,
9
3
  get_artifact,
10
4
  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,
11
23
  get_function,
12
24
  get_function_versions,
13
- get_run,
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,
14
52
  get_secret,
15
53
  get_secret_versions,
16
- get_task,
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,
17
62
  get_workflow,
18
63
  get_workflow_versions,
19
- import_artifact,
20
- import_function,
21
- import_run,
22
- import_secret,
23
- import_task,
24
64
  import_workflow,
25
- list_artifacts,
26
- list_functions,
27
- list_runs,
28
- list_secrets,
29
- list_tasks,
30
65
  list_workflows,
31
- log_artifact,
32
- new_artifact,
33
- new_function,
34
- new_run,
35
- new_secret,
36
- new_task,
37
66
  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,
47
67
  update_workflow,
48
68
  )
49
- from digitalhub_core.registry.utils import register_layer_entities, register_runtimes_entities
50
-
51
- _PROJECT_IMPORTED = False
52
-
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
- )
80
-
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
- ...
106
69
 
107
- if not _PROJECT_IMPORTED:
108
- from digitalhub_core import get_or_create_project, get_project, import_project, load_project, new_project
70
+ try:
71
+ from digitalhub.entities.model.entity.mlflow import from_mlflow_run
72
+ except ImportError:
73
+ ...
109
74
 
75
+ from digitalhub.registry.utils import register_entities, register_runtimes_entities
76
+ from digitalhub.stores.builder import set_store
77
+ from digitalhub.utils.env_utils import refresh_token, set_dhcore_env
110
78
 
111
79
  # Register entities into registry
112
- register_layer_entities()
80
+ register_entities()
113
81
  register_runtimes_entities()
File without changes
@@ -0,0 +1,105 @@
1
+ from __future__ import annotations
2
+
3
+ import typing
4
+
5
+ from digitalhub.client.objects.dhcore import ClientDHCore
6
+ from digitalhub.client.objects.local import ClientLocal
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from digitalhub.client.objects.base 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
+ def get_client(local: bool = False) -> Client:
51
+ """
52
+ Wrapper around ClientBuilder.build.
53
+
54
+ Parameters
55
+ ----------
56
+ local : bool
57
+ Whether to create a local client or not.
58
+
59
+ Returns
60
+ -------
61
+ Client
62
+ The client instance.
63
+ """
64
+ return client_builder.build(local)
65
+
66
+
67
+ def build_client(local: bool = False, config: dict | None = None) -> None:
68
+ """
69
+ Wrapper around ClientBuilder.build.
70
+
71
+ Parameters
72
+ ----------
73
+ local : bool
74
+ Whether to create a local client or not.
75
+ config : dict
76
+ DHCore environment configuration.
77
+
78
+ Returns
79
+ -------
80
+ Client
81
+ The client instance.
82
+ """
83
+ client_builder.build(local, config)
84
+
85
+
86
+ def check_client_exists(local: bool = False) -> bool:
87
+ """
88
+ Check if client exists.
89
+
90
+ Parameters
91
+ ----------
92
+ local : bool
93
+ Check client existence by local.
94
+
95
+ Returns
96
+ -------
97
+ bool
98
+ True if client exists, False otherwise.
99
+ """
100
+ if local:
101
+ return client_builder._local is not None
102
+ return client_builder._dhcore is not None
103
+
104
+
105
+ client_builder = ClientBuilder()
File without changes
@@ -0,0 +1,56 @@
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
+ """