digitalhub 0.14.0b7__py3-none-any.whl → 0.14.1b0__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 (68) hide show
  1. digitalhub/__init__.py +2 -2
  2. digitalhub/context/api.py +42 -1
  3. digitalhub/context/context.py +3 -6
  4. digitalhub/entities/_base/context/entity.py +0 -3
  5. digitalhub/entities/_base/material/entity.py +2 -2
  6. digitalhub/entities/_processors/base/crud.py +14 -23
  7. digitalhub/entities/_processors/base/import_export.py +0 -5
  8. digitalhub/entities/_processors/base/processor.py +1 -4
  9. digitalhub/entities/_processors/base/special_ops.py +4 -8
  10. digitalhub/entities/_processors/context/crud.py +5 -5
  11. digitalhub/entities/_processors/context/import_export.py +5 -5
  12. digitalhub/entities/_processors/context/material.py +2 -2
  13. digitalhub/entities/_processors/context/special_ops.py +13 -13
  14. digitalhub/entities/_processors/utils.py +2 -111
  15. digitalhub/entities/function/_base/entity.py +0 -3
  16. digitalhub/entities/project/_base/builder.py +0 -6
  17. digitalhub/entities/project/_base/entity.py +4 -12
  18. digitalhub/entities/project/_base/spec.py +4 -4
  19. digitalhub/entities/project/crud.py +9 -44
  20. digitalhub/entities/project/utils.py +7 -3
  21. digitalhub/entities/workflow/_base/entity.py +0 -5
  22. digitalhub/stores/client/{dhcore/api_builder.py → api_builder.py} +2 -3
  23. digitalhub/stores/client/builder.py +20 -32
  24. digitalhub/stores/client/{dhcore/client.py → client.py} +64 -23
  25. digitalhub/stores/client/{dhcore/configurator.py → configurator.py} +122 -176
  26. digitalhub/stores/client/{_base/enums.py → enums.py} +11 -0
  27. digitalhub/stores/client/{dhcore/http_handler.py → http_handler.py} +4 -5
  28. digitalhub/stores/client/{_base/key_builder.py → key_builder.py} +13 -13
  29. digitalhub/stores/client/{dhcore/params_builder.py → params_builder.py} +51 -12
  30. digitalhub/stores/client/{dhcore/response_processor.py → response_processor.py} +1 -1
  31. digitalhub/stores/client/{dhcore/utils.py → utils.py} +2 -7
  32. digitalhub/stores/{credentials → configurator}/api.py +5 -5
  33. digitalhub/stores/configurator/configurator.py +123 -0
  34. digitalhub/stores/{credentials → configurator}/enums.py +25 -10
  35. digitalhub/stores/configurator/handler.py +213 -0
  36. digitalhub/stores/{credentials → configurator}/ini_module.py +31 -0
  37. digitalhub/stores/data/_base/store.py +0 -4
  38. digitalhub/stores/data/api.py +2 -4
  39. digitalhub/stores/data/builder.py +5 -37
  40. digitalhub/stores/data/s3/configurator.py +30 -114
  41. digitalhub/stores/data/s3/store.py +9 -22
  42. digitalhub/stores/data/sql/configurator.py +49 -71
  43. digitalhub/stores/data/sql/store.py +20 -55
  44. {digitalhub-0.14.0b7.dist-info → digitalhub-0.14.1b0.dist-info}/METADATA +1 -1
  45. {digitalhub-0.14.0b7.dist-info → digitalhub-0.14.1b0.dist-info}/RECORD +51 -66
  46. digitalhub/stores/client/_base/api_builder.py +0 -34
  47. digitalhub/stores/client/_base/client.py +0 -243
  48. digitalhub/stores/client/_base/params_builder.py +0 -82
  49. digitalhub/stores/client/api.py +0 -32
  50. digitalhub/stores/client/dhcore/__init__.py +0 -3
  51. digitalhub/stores/client/dhcore/enums.py +0 -18
  52. digitalhub/stores/client/dhcore/key_builder.py +0 -62
  53. digitalhub/stores/client/local/__init__.py +0 -3
  54. digitalhub/stores/client/local/api_builder.py +0 -116
  55. digitalhub/stores/client/local/client.py +0 -605
  56. digitalhub/stores/client/local/enums.py +0 -15
  57. digitalhub/stores/client/local/key_builder.py +0 -62
  58. digitalhub/stores/client/local/params_builder.py +0 -97
  59. digitalhub/stores/credentials/__init__.py +0 -3
  60. digitalhub/stores/credentials/configurator.py +0 -185
  61. digitalhub/stores/credentials/handler.py +0 -164
  62. digitalhub/stores/credentials/store.py +0 -77
  63. /digitalhub/stores/client/{dhcore/error_parser.py → error_parser.py} +0 -0
  64. /digitalhub/stores/client/{dhcore/header_manager.py → header_manager.py} +0 -0
  65. /digitalhub/stores/{client/_base → configurator}/__init__.py +0 -0
  66. {digitalhub-0.14.0b7.dist-info → digitalhub-0.14.1b0.dist-info}/WHEEL +0 -0
  67. {digitalhub-0.14.0b7.dist-info → digitalhub-0.14.1b0.dist-info}/licenses/AUTHORS +0 -0
  68. {digitalhub-0.14.0b7.dist-info → digitalhub-0.14.1b0.dist-info}/licenses/LICENSE +0 -0
@@ -7,16 +7,11 @@ from __future__ import annotations
7
7
  import typing
8
8
 
9
9
  from digitalhub.context.api import get_context
10
- from digitalhub.entities._commons.enums import EntityTypes
11
10
  from digitalhub.entities._commons.utils import get_project_from_key, is_valid_key, parse_entity_key
12
- from digitalhub.factory.entity import entity_factory
13
- from digitalhub.stores.client._base.enums import ApiCategories, BackendOperations
14
- from digitalhub.stores.client.api import get_client
15
- from digitalhub.utils.exceptions import ContextError, EntityError, EntityNotExistsError
11
+ from digitalhub.utils.exceptions import EntityError
16
12
 
17
13
  if typing.TYPE_CHECKING:
18
14
  from digitalhub.context.context import Context
19
- from digitalhub.stores.client._base.client import Client
20
15
 
21
16
 
22
17
  def parse_identifier(
@@ -100,108 +95,4 @@ def get_context_from_identifier(
100
95
  else:
101
96
  project = get_project_from_key(identifier)
102
97
 
103
- return get_context_from_project(project)
104
-
105
-
106
- def get_context_from_project(
107
- project: str,
108
- ) -> Context:
109
- """
110
- Retrieve context for a project, fetching from remote if necessary.
111
-
112
- Attempts to get the project context from the local cache first.
113
- If the project is not found locally, tries to fetch it from the
114
- remote backend and create the context.
115
-
116
- Parameters
117
- ----------
118
- project : str
119
- The name of the project to get context for.
120
-
121
- Returns
122
- -------
123
- Context
124
- The context instance for the specified project.
125
-
126
- Raises
127
- ------
128
- ContextError
129
- If the project cannot be found locally or remotely.
130
- """
131
- try:
132
- return get_context(project)
133
- except ContextError:
134
- return get_context_from_remote(project)
135
-
136
-
137
- def get_context_from_remote(
138
- project: str,
139
- ) -> Context:
140
- """
141
- Fetch project context from remote backend and create local context.
142
-
143
- Retrieves project information from the remote backend, builds the
144
- project entity locally, and returns the corresponding context.
145
- Used when a project is not available in the local context cache.
146
-
147
- Parameters
148
- ----------
149
- project : str
150
- The name of the project to fetch from remote.
151
-
152
- Returns
153
- -------
154
- Context
155
- The context instance created from the remote project data.
156
-
157
- Raises
158
- ------
159
- ContextError
160
- If the project is not found on the remote backend.
161
- """
162
- try:
163
- client = get_client()
164
- obj = _read_base_entity(client, EntityTypes.PROJECT.value, project)
165
- entity_factory.build_entity_from_dict(obj)
166
- return get_context(project)
167
- except EntityNotExistsError:
168
- raise ContextError(f"Project '{project}' not found.")
169
-
170
-
171
- def _read_base_entity(
172
- client: Client,
173
- entity_type: str,
174
- entity_name: str,
175
- **kwargs,
176
- ) -> dict:
177
- """
178
- Read entity data from the backend API.
179
-
180
- Internal utility function that performs a base-level entity read
181
- operation through the client API. Builds the appropriate API
182
- endpoint and retrieves the entity data as a dictionary.
183
-
184
- Parameters
185
- ----------
186
- client : Client
187
- The client instance to use for the API request.
188
- entity_type : str
189
- The type of entity to read (e.g., 'project', 'function').
190
- entity_name : str
191
- The name identifier of the entity to retrieve.
192
- **kwargs : dict
193
- Additional parameters to pass to the API call, such as
194
- version specifications or query filters.
195
-
196
- Returns
197
- -------
198
- dict
199
- Dictionary containing the entity data retrieved from the backend.
200
- """
201
- api = client.build_api(
202
- ApiCategories.BASE.value,
203
- BackendOperations.READ.value,
204
- entity_type=entity_type,
205
- entity_name=entity_name,
206
- )
207
- return client.read_object(api, **kwargs)
98
+ return get_context(project)
@@ -10,7 +10,6 @@ from concurrent.futures import ThreadPoolExecutor
10
10
  from digitalhub.entities._base.executable.entity import ExecutableEntity
11
11
  from digitalhub.entities._commons.enums import EntityTypes, Relationship
12
12
  from digitalhub.factory.entity import entity_factory
13
- from digitalhub.utils.exceptions import BackendError
14
13
 
15
14
  if typing.TYPE_CHECKING:
16
15
  from digitalhub.entities._base.entity.metadata import Metadata
@@ -91,8 +90,6 @@ class Function(ExecutableEntity):
91
90
 
92
91
  # If execution is done by DHCore backend, return the object
93
92
  if not local_execution:
94
- if self._context().local:
95
- raise BackendError("Cannot run remote function with local backend.")
96
93
  if wait:
97
94
  return run.wait(log_info=log_info)
98
95
  return run
@@ -29,7 +29,6 @@ class ProjectProjectBuilder(EntityBuilder):
29
29
  kind: str,
30
30
  description: str | None = None,
31
31
  labels: list[str] | None = None,
32
- local: bool = False,
33
32
  config: dict | None = None,
34
33
  context: str | None = None,
35
34
  **kwargs,
@@ -47,8 +46,6 @@ class ProjectProjectBuilder(EntityBuilder):
47
46
  Description of the object (human readable).
48
47
  labels : list[str]
49
48
  List of labels.
50
- local : bool
51
- If True, use local backend, if False use DHCore backend. Default to False.
52
49
  config : dict
53
50
  DHCore environment configuration.
54
51
  context : str
@@ -80,7 +77,6 @@ class ProjectProjectBuilder(EntityBuilder):
80
77
  metadata=metadata,
81
78
  spec=spec,
82
79
  status=status,
83
- local=local,
84
80
  )
85
81
 
86
82
  def from_dict(self, obj: dict, validate: bool = True) -> Project:
@@ -120,7 +116,6 @@ class ProjectProjectBuilder(EntityBuilder):
120
116
  """
121
117
  name = self.build_name(obj.get("name"))
122
118
  kind = obj.get("kind")
123
- local = obj.get("local", False)
124
119
  metadata = self.build_metadata(**obj.get("metadata", {}))
125
120
  spec = self.build_spec(validate=validate, **obj.get("spec", {}))
126
121
  status = self.build_status(**obj.get("status", {}))
@@ -132,5 +127,4 @@ class ProjectProjectBuilder(EntityBuilder):
132
127
  "spec": spec,
133
128
  "status": status,
134
129
  "user": user,
135
- "local": local,
136
130
  }
@@ -72,9 +72,8 @@ from digitalhub.entities.workflow.crud import (
72
72
  update_workflow,
73
73
  )
74
74
  from digitalhub.factory.entity import entity_factory
75
- from digitalhub.stores.client.api import get_client
75
+ from digitalhub.stores.client.builder import get_client
76
76
  from digitalhub.utils.exceptions import BackendError, EntityAlreadyExistsError, EntityError
77
- from digitalhub.utils.generic_utils import get_timestamp
78
77
  from digitalhub.utils.io_utils import write_yaml
79
78
  from digitalhub.utils.uri_utils import has_local_scheme
80
79
 
@@ -107,7 +106,6 @@ class Project(Entity):
107
106
  spec: ProjectSpec,
108
107
  status: ProjectStatus,
109
108
  user: str | None = None,
110
- local: bool = False,
111
109
  ) -> None:
112
110
  super().__init__(kind, metadata, spec, status, user)
113
111
  self.spec: ProjectSpec
@@ -115,12 +113,12 @@ class Project(Entity):
115
113
 
116
114
  self.id = name
117
115
  self.name = name
118
- self.key = base_processor.build_project_key(self.name, local=local)
116
+ self.key = base_processor.build_project_key(self.name)
119
117
 
120
118
  self._obj_attr.extend(["id", "name"])
121
119
 
122
120
  # Set client
123
- self._client = get_client(local)
121
+ self._client = get_client()
124
122
 
125
123
  # Set context
126
124
  build_context(self)
@@ -144,13 +142,10 @@ class Project(Entity):
144
142
  Entity saved.
145
143
  """
146
144
  if update:
147
- if self._client.is_local():
148
- self.metadata.updated = get_timestamp()
149
145
  new_obj = base_processor.update_project_entity(
150
146
  entity_type=self.ENTITY_TYPE,
151
147
  entity_name=self.name,
152
148
  entity_dict=self.to_dict(),
153
- local=self._client.is_local(),
154
149
  )
155
150
  else:
156
151
  new_obj = base_processor.create_project_entity(_entity=self)
@@ -169,7 +164,6 @@ class Project(Entity):
169
164
  new_obj = base_processor.read_project_entity(
170
165
  entity_type=self.ENTITY_TYPE,
171
166
  entity_name=self.name,
172
- local=self._client.is_local(),
173
167
  )
174
168
  self._update_attributes(new_obj)
175
169
  return self
@@ -241,7 +235,7 @@ class Project(Entity):
241
235
  Exported filepath.
242
236
  """
243
237
  obj = self._refresh_to_dict()
244
- pth = Path(self.spec.context) / f"{self.ENTITY_TYPE}s-{self.name}.yaml"
238
+ pth = Path(self.spec.source) / f"{self.ENTITY_TYPE}s-{self.name}.yaml"
245
239
  obj = self._export_not_embedded(obj)
246
240
  write_yaml(pth, obj)
247
241
  return str(pth)
@@ -2346,7 +2340,6 @@ class Project(Entity):
2346
2340
  entity_name=self.name,
2347
2341
  user=user,
2348
2342
  unshare=False,
2349
- local=self._client.is_local(),
2350
2343
  )
2351
2344
 
2352
2345
  def unshare(self, user: str) -> None:
@@ -2366,5 +2359,4 @@ class Project(Entity):
2366
2359
  entity_name=self.name,
2367
2360
  user=user,
2368
2361
  unshare=True,
2369
- local=self._client.is_local(),
2370
2362
  )
@@ -17,7 +17,7 @@ class ProjectSpec(Spec):
17
17
 
18
18
  def __init__(
19
19
  self,
20
- context: str | None = None,
20
+ source: str | None = None,
21
21
  functions: list | None = None,
22
22
  artifacts: list | None = None,
23
23
  workflows: list | None = None,
@@ -26,7 +26,7 @@ class ProjectSpec(Spec):
26
26
  config: dict | None = None,
27
27
  **kwargs,
28
28
  ) -> None:
29
- self.context = context if context is not None else "./"
29
+ self.source = source if source is not None else "./"
30
30
  self.functions = functions if functions is not None else []
31
31
  self.artifacts = artifacts if artifacts is not None else []
32
32
  self.workflows = workflows if workflows is not None else []
@@ -40,8 +40,8 @@ class ProjectValidator(SpecValidator):
40
40
  ProjectValidator validator.
41
41
  """
42
42
 
43
- context: Optional[str] = None
44
- """The project's context."""
43
+ source: Optional[str] = None
44
+ """The project's source."""
45
45
 
46
46
  functions: Optional[list] = None
47
47
  """List of project's functions."""
@@ -23,11 +23,9 @@ def new_project(
23
23
  name: str,
24
24
  description: str | None = None,
25
25
  labels: list[str] | None = None,
26
- local: bool = False,
27
26
  config: dict | None = None,
28
27
  context: str | None = None,
29
28
  setup_kwargs: dict | None = None,
30
- **kwargs,
31
29
  ) -> Project:
32
30
  """
33
31
  Create a new object.
@@ -40,16 +38,12 @@ def new_project(
40
38
  Description of the object (human readable).
41
39
  labels : list[str]
42
40
  List of labels.
43
- local : bool
44
- If True, use local backend, if False use DHCore backend. Default to False.
45
41
  config : dict
46
42
  DHCore environment configuration.
47
43
  context : str
48
44
  The context local folder of the project.
49
45
  setup_kwargs : dict
50
46
  Setup keyword arguments passed to setup_project() function.
51
- **kwargs : dict
52
- Keyword arguments.
53
47
 
54
48
  Returns
55
49
  -------
@@ -64,20 +58,17 @@ def new_project(
64
58
  context = "./"
65
59
  obj = base_processor.create_project_entity(
66
60
  name=name,
67
- kind="project",
61
+ kind=EntityTypes.PROJECT.value,
68
62
  description=description,
69
63
  labels=labels,
70
- local=local,
71
64
  config=config,
72
65
  context=context,
73
- **kwargs,
74
66
  )
75
67
  return setup_project(obj, setup_kwargs)
76
68
 
77
69
 
78
70
  def get_project(
79
71
  name: str,
80
- local: bool = False,
81
72
  setup_kwargs: dict | None = None,
82
73
  ) -> Project:
83
74
  """
@@ -87,8 +78,6 @@ def get_project(
87
78
  ----------
88
79
  name : str
89
80
  The Project name.
90
- local : bool
91
- Flag to determine if backend is local.
92
81
  setup_kwargs : dict
93
82
  Setup keyword arguments passed to setup_project() function.
94
83
 
@@ -104,14 +93,12 @@ def get_project(
104
93
  obj = base_processor.read_project_entity(
105
94
  entity_type=ENTITY_TYPE,
106
95
  entity_name=name,
107
- local=local,
108
96
  )
109
97
  return setup_project(obj, setup_kwargs)
110
98
 
111
99
 
112
100
  def import_project(
113
101
  file: str,
114
- local: bool = False,
115
102
  setup_kwargs: dict | None = None,
116
103
  reset_id: bool = False,
117
104
  ) -> Project:
@@ -122,8 +109,6 @@ def import_project(
122
109
  ----------
123
110
  file : str
124
111
  Path to YAML file.
125
- local : bool
126
- Flag to determine if backend is local.
127
112
  setup_kwargs : dict
128
113
  Setup keyword arguments passed to setup_project() function.
129
114
  reset_id : bool
@@ -140,7 +125,6 @@ def import_project(
140
125
  """
141
126
  obj = base_processor.import_project_entity(
142
127
  file=file,
143
- local=local,
144
128
  reset_id=reset_id,
145
129
  )
146
130
  return setup_project(obj, setup_kwargs)
@@ -148,7 +132,6 @@ def import_project(
148
132
 
149
133
  def load_project(
150
134
  file: str,
151
- local: bool = False,
152
135
  setup_kwargs: dict | None = None,
153
136
  ) -> Project:
154
137
  """
@@ -158,8 +141,6 @@ def load_project(
158
141
  ----------
159
142
  file : str
160
143
  Path to YAML file.
161
- local : bool
162
- Flag to determine if backend is local.
163
144
  setup_kwargs : dict
164
145
  Setup keyword arguments passed to setup_project() function.
165
146
 
@@ -172,34 +153,30 @@ def load_project(
172
153
  --------
173
154
  >>> obj = load_project("my-project.yaml")
174
155
  """
175
- obj = base_processor.load_project_entity(file=file, local=local)
156
+ obj = base_processor.load_project_entity(file=file)
176
157
  return setup_project(obj, setup_kwargs)
177
158
 
178
159
 
179
- def list_projects(local: bool = False) -> list[Project]:
160
+ def list_projects() -> list[Project]:
180
161
  """
181
162
  List projects in backend.
182
163
 
183
- Parameters
184
- ----------
185
- local : bool
186
- Flag to determine if backend is local.
187
164
 
188
165
  Returns
189
166
  -------
190
167
  list
191
168
  List of objects.
192
169
  """
193
- return base_processor.list_project_entities(local=local)
170
+ return base_processor.list_project_entities()
194
171
 
195
172
 
196
173
  def get_or_create_project(
197
174
  name: str,
198
- local: bool = False,
175
+ description: str | None = None,
176
+ labels: list[str] | None = None,
199
177
  config: dict | None = None,
200
178
  context: str | None = None,
201
179
  setup_kwargs: dict | None = None,
202
- **kwargs,
203
180
  ) -> Project:
204
181
  """
205
182
  Try to get project. If not exists, create it.
@@ -208,8 +185,6 @@ def get_or_create_project(
208
185
  ----------
209
186
  name : str
210
187
  Project name.
211
- local : bool
212
- Flag to determine if backend is local.
213
188
  config : dict
214
189
  DHCore environment configuration.
215
190
  context : str
@@ -227,22 +202,20 @@ def get_or_create_project(
227
202
  try:
228
203
  return get_project(
229
204
  name,
230
- local=local,
231
205
  setup_kwargs=setup_kwargs,
232
- **kwargs,
233
206
  )
234
207
  except BackendError:
235
208
  return new_project(
236
209
  name,
237
- local=local,
210
+ description=description,
211
+ labels=labels,
238
212
  config=config,
239
213
  setup_kwargs=setup_kwargs,
240
214
  context=context,
241
- **kwargs,
242
215
  )
243
216
 
244
217
 
245
- def update_project(entity: Project, **kwargs) -> Project:
218
+ def update_project(entity: Project) -> Project:
246
219
  """
247
220
  Update object. Note that object spec are immutable.
248
221
 
@@ -250,8 +223,6 @@ def update_project(entity: Project, **kwargs) -> Project:
250
223
  ----------
251
224
  entity : Project
252
225
  Object to update.
253
- **kwargs : dict
254
- Parameters to pass to the API call.
255
226
 
256
227
  Returns
257
228
  -------
@@ -266,8 +237,6 @@ def update_project(entity: Project, **kwargs) -> Project:
266
237
  entity_type=entity.ENTITY_TYPE,
267
238
  entity_name=entity.name,
268
239
  entity_dict=entity.to_dict(),
269
- local=entity._client.is_local(),
270
- **kwargs,
271
240
  )
272
241
 
273
242
 
@@ -275,7 +244,6 @@ def delete_project(
275
244
  name: str,
276
245
  cascade: bool = True,
277
246
  clean_context: bool = True,
278
- local: bool = False,
279
247
  ) -> dict:
280
248
  """
281
249
  Delete a project.
@@ -288,8 +256,6 @@ def delete_project(
288
256
  Flag to determine if delete is cascading.
289
257
  clean_context : bool
290
258
  Flag to determine if context will be deleted.
291
- local : bool
292
- Flag to determine if backend is local.
293
259
 
294
260
  Returns
295
261
  -------
@@ -303,7 +269,6 @@ def delete_project(
303
269
  return base_processor.delete_project_entity(
304
270
  entity_type=ENTITY_TYPE,
305
271
  entity_name=name,
306
- local=local,
307
272
  cascade=cascade,
308
273
  clean_context=clean_context,
309
274
  )
@@ -12,6 +12,10 @@ from digitalhub.utils.generic_utils import import_function
12
12
  if typing.TYPE_CHECKING:
13
13
  from digitalhub.entities.project._base.entity import Project
14
14
 
15
+ CHECK_FILENAME = ".CHECK"
16
+ SETUP_MODULE = "setup_project.py"
17
+ SETUP_FUNCTION = "setup"
18
+
15
19
 
16
20
  def setup_project(project: Project, setup_kwargs: dict | None = None) -> Project:
17
21
  """
@@ -30,10 +34,10 @@ def setup_project(project: Project, setup_kwargs: dict | None = None) -> Project
30
34
  Set up project.
31
35
  """
32
36
  setup_kwargs = setup_kwargs if setup_kwargs is not None else {}
33
- check_pth = Path(project.spec.context, ".CHECK")
34
- setup_pth = Path(project.spec.context, "setup_project.py")
37
+ check_pth = Path(project.spec.source, CHECK_FILENAME)
38
+ setup_pth = Path(project.spec.source, SETUP_MODULE)
35
39
  if setup_pth.exists() and not check_pth.exists():
36
- setup_fnc = import_function(setup_pth, "setup")
40
+ setup_fnc = import_function(setup_pth, SETUP_FUNCTION)
37
41
  project = setup_fnc(project, **setup_kwargs)
38
42
  check_pth.touch()
39
43
  return project
@@ -9,7 +9,6 @@ import typing
9
9
  from digitalhub.entities._base.executable.entity import ExecutableEntity
10
10
  from digitalhub.entities._commons.enums import EntityTypes, Relationship
11
11
  from digitalhub.factory.entity import entity_factory
12
- from digitalhub.utils.exceptions import BackendError
13
12
 
14
13
  if typing.TYPE_CHECKING:
15
14
  from digitalhub.entities._base.entity.metadata import Metadata
@@ -78,10 +77,6 @@ class Workflow(ExecutableEntity):
78
77
  # Create or update new task
79
78
  task = self._get_or_create_task(task_kind)
80
79
 
81
- # Raise error if execution is not done by DHCore backend
82
- if self._context().local:
83
- raise BackendError("Cannot run workflow with local backend.")
84
-
85
80
  # Run task
86
81
  run = task.run(run_kind, save=False, local_execution=False, **kwargs)
87
82
 
@@ -4,15 +4,14 @@
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
- from digitalhub.stores.client._base.api_builder import ClientApiBuilder
8
- from digitalhub.stores.client._base.enums import ApiCategories, BackendOperations
7
+ from digitalhub.stores.client.enums import ApiCategories, BackendOperations
9
8
  from digitalhub.utils.exceptions import BackendError
10
9
 
11
10
  API_BASE = "/api/v1"
12
11
  API_CONTEXT = f"{API_BASE}/-"
13
12
 
14
13
 
15
- class ClientDHCoreApiBuilder(ClientApiBuilder):
14
+ class ClientApiBuilder:
16
15
  """
17
16
  This class is used to build the API for the DHCore client.
18
17
  """
@@ -4,53 +4,41 @@
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
- import typing
8
-
9
- from digitalhub.stores.client.dhcore.client import ClientDHCore
10
- from digitalhub.stores.client.local.client import ClientLocal
11
-
12
- if typing.TYPE_CHECKING:
13
- pass
7
+ from digitalhub.stores.client.client import Client
14
8
 
15
9
 
16
10
  class ClientBuilder:
17
11
  """
18
- Client builder class.
19
-
20
- This class is used to create two possible client instances:
21
- Local and DHCore.
22
- It saves the client instances in the class attributes using
23
- singleton pattern.
12
+ Client builder class. Creates and returns client instance.
24
13
  """
25
14
 
26
15
  def __init__(self) -> None:
27
- self._local = None
28
- self._dhcore = None
16
+ self._client: Client = None
29
17
 
30
- def build(self, local: bool = False, config: dict | None = None) -> ClientLocal | ClientDHCore:
18
+ def build(self) -> Client:
31
19
  """
32
20
  Method to create a client instance.
33
21
 
34
- Parameters
35
- ----------
36
- local : bool, default False
37
- Whether to create a local client or not.
38
- config : dict
39
- DHCore environment configuration.
40
-
41
22
  Returns
42
23
  -------
43
- ClientLocal | ClientDHCore
24
+ Client
44
25
  Returns the client instance.
45
26
  """
46
- if local:
47
- if self._local is None:
48
- self._local = ClientLocal()
49
- return self._local
50
-
51
- if self._dhcore is None:
52
- self._dhcore = ClientDHCore(config)
53
- return self._dhcore
27
+ if self._client is None:
28
+ self._client = Client()
29
+ return self._client
54
30
 
55
31
 
56
32
  client_builder = ClientBuilder()
33
+
34
+
35
+ def get_client() -> Client:
36
+ """
37
+ Wrapper around ClientBuilder.build.
38
+
39
+ Returns
40
+ -------
41
+ Client
42
+ The client instance.
43
+ """
44
+ return client_builder.build()