digitalhub 0.13.3__py3-none-any.whl → 0.14.0__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 (116) hide show
  1. digitalhub/__init__.py +3 -8
  2. digitalhub/context/api.py +1 -5
  3. digitalhub/context/builder.py +1 -5
  4. digitalhub/context/context.py +15 -9
  5. digitalhub/entities/_base/_base/entity.py +0 -15
  6. digitalhub/entities/_base/context/entity.py +1 -1
  7. digitalhub/entities/_base/entity/builder.py +5 -5
  8. digitalhub/entities/_base/entity/entity.py +0 -8
  9. digitalhub/entities/_base/executable/entity.py +169 -79
  10. digitalhub/entities/_base/material/entity.py +6 -22
  11. digitalhub/entities/_base/material/utils.py +1 -4
  12. digitalhub/entities/_base/runtime_entity/builder.py +53 -18
  13. digitalhub/entities/_base/unversioned/entity.py +1 -1
  14. digitalhub/entities/_base/versioned/entity.py +1 -1
  15. digitalhub/entities/_commons/enums.py +1 -31
  16. digitalhub/entities/_commons/utils.py +83 -21
  17. digitalhub/entities/_constructors/_resources.py +151 -0
  18. digitalhub/entities/{_base/entity/_constructors → _constructors}/name.py +18 -0
  19. digitalhub/entities/_processors/base/__init__.py +3 -0
  20. digitalhub/entities/_processors/{base.py → base/crud.py} +14 -226
  21. digitalhub/entities/_processors/base/import_export.py +123 -0
  22. digitalhub/entities/_processors/base/processor.py +302 -0
  23. digitalhub/entities/_processors/base/special_ops.py +108 -0
  24. digitalhub/entities/_processors/context/__init__.py +3 -0
  25. digitalhub/entities/_processors/context/crud.py +652 -0
  26. digitalhub/entities/_processors/context/import_export.py +242 -0
  27. digitalhub/entities/_processors/context/material.py +123 -0
  28. digitalhub/entities/_processors/context/processor.py +400 -0
  29. digitalhub/entities/_processors/context/special_ops.py +476 -0
  30. digitalhub/entities/_processors/processors.py +12 -0
  31. digitalhub/entities/_processors/utils.py +12 -11
  32. digitalhub/entities/artifact/crud.py +58 -22
  33. digitalhub/entities/artifact/utils.py +3 -3
  34. digitalhub/entities/dataitem/crud.py +63 -20
  35. digitalhub/entities/dataitem/table/entity.py +24 -22
  36. digitalhub/entities/dataitem/utils.py +15 -15
  37. digitalhub/entities/function/_base/entity.py +3 -3
  38. digitalhub/entities/function/crud.py +55 -24
  39. digitalhub/entities/model/_base/entity.py +62 -20
  40. digitalhub/entities/model/crud.py +58 -22
  41. digitalhub/entities/model/utils.py +3 -3
  42. digitalhub/entities/project/_base/entity.py +321 -152
  43. digitalhub/entities/project/crud.py +15 -23
  44. digitalhub/entities/run/_base/builder.py +0 -4
  45. digitalhub/entities/run/_base/entity.py +70 -63
  46. digitalhub/entities/run/crud.py +79 -26
  47. digitalhub/entities/secret/_base/entity.py +1 -5
  48. digitalhub/entities/secret/crud.py +29 -26
  49. digitalhub/entities/task/_base/builder.py +0 -4
  50. digitalhub/entities/task/_base/entity.py +5 -5
  51. digitalhub/entities/task/_base/models.py +13 -16
  52. digitalhub/entities/task/crud.py +61 -29
  53. digitalhub/entities/trigger/_base/entity.py +1 -5
  54. digitalhub/entities/trigger/crud.py +64 -24
  55. digitalhub/entities/workflow/_base/entity.py +3 -3
  56. digitalhub/entities/workflow/crud.py +55 -21
  57. digitalhub/factory/entity.py +283 -0
  58. digitalhub/factory/enums.py +18 -0
  59. digitalhub/factory/registry.py +197 -0
  60. digitalhub/factory/runtime.py +44 -0
  61. digitalhub/factory/utils.py +3 -54
  62. digitalhub/runtimes/_base.py +2 -2
  63. digitalhub/stores/client/_base/enums.py +39 -0
  64. digitalhub/stores/client/_base/key_builder.py +2 -2
  65. digitalhub/stores/client/_base/params_builder.py +48 -0
  66. digitalhub/stores/client/api.py +6 -10
  67. digitalhub/stores/client/builder.py +4 -4
  68. digitalhub/stores/client/dhcore/api_builder.py +2 -1
  69. digitalhub/stores/client/dhcore/client.py +85 -429
  70. digitalhub/stores/client/dhcore/configurator.py +109 -328
  71. digitalhub/stores/client/dhcore/enums.py +0 -16
  72. digitalhub/stores/client/dhcore/error_parser.py +0 -4
  73. digitalhub/stores/client/dhcore/header_manager.py +61 -0
  74. digitalhub/stores/client/dhcore/http_handler.py +133 -0
  75. digitalhub/stores/client/dhcore/params_builder.py +147 -134
  76. digitalhub/stores/client/dhcore/response_processor.py +102 -0
  77. digitalhub/stores/client/dhcore/utils.py +6 -72
  78. digitalhub/stores/client/local/api_builder.py +1 -1
  79. digitalhub/stores/client/local/client.py +79 -47
  80. digitalhub/stores/client/local/params_builder.py +18 -41
  81. digitalhub/stores/credentials/api.py +0 -4
  82. digitalhub/stores/credentials/configurator.py +2 -28
  83. digitalhub/stores/credentials/enums.py +3 -0
  84. digitalhub/stores/credentials/handler.py +0 -12
  85. digitalhub/stores/credentials/ini_module.py +0 -22
  86. digitalhub/stores/credentials/store.py +0 -4
  87. digitalhub/stores/data/_base/store.py +0 -16
  88. digitalhub/stores/data/builder.py +1 -5
  89. digitalhub/stores/data/local/store.py +0 -103
  90. digitalhub/stores/data/remote/store.py +0 -4
  91. digitalhub/stores/data/s3/configurator.py +60 -14
  92. digitalhub/stores/data/s3/store.py +49 -16
  93. digitalhub/stores/data/sql/configurator.py +0 -8
  94. digitalhub/stores/data/sql/store.py +21 -10
  95. digitalhub/stores/readers/data/factory.py +0 -8
  96. digitalhub/stores/readers/data/pandas/reader.py +0 -16
  97. digitalhub/utils/file_utils.py +0 -17
  98. digitalhub/utils/generic_utils.py +0 -12
  99. digitalhub/utils/git_utils.py +0 -8
  100. digitalhub/utils/io_utils.py +0 -12
  101. digitalhub/utils/store_utils.py +44 -0
  102. {digitalhub-0.13.3.dist-info → digitalhub-0.14.0.dist-info}/METADATA +3 -2
  103. {digitalhub-0.13.3.dist-info → digitalhub-0.14.0.dist-info}/RECORD +111 -95
  104. digitalhub/entities/_processors/context.py +0 -1450
  105. digitalhub/entities/task/_base/utils.py +0 -22
  106. digitalhub/factory/factory.py +0 -381
  107. digitalhub/stores/client/dhcore/models.py +0 -40
  108. digitalhub/stores/data/s3/utils.py +0 -78
  109. /digitalhub/entities/{_base/entity/_constructors → _constructors}/__init__.py +0 -0
  110. /digitalhub/entities/{_base/entity/_constructors → _constructors}/metadata.py +0 -0
  111. /digitalhub/entities/{_base/entity/_constructors → _constructors}/spec.py +0 -0
  112. /digitalhub/entities/{_base/entity/_constructors → _constructors}/status.py +0 -0
  113. /digitalhub/entities/{_base/entity/_constructors → _constructors}/uuid.py +0 -0
  114. {digitalhub-0.13.3.dist-info → digitalhub-0.14.0.dist-info}/WHEEL +0 -0
  115. {digitalhub-0.13.3.dist-info → digitalhub-0.14.0.dist-info}/licenses/AUTHORS +0 -0
  116. {digitalhub-0.13.3.dist-info → digitalhub-0.14.0.dist-info}/licenses/LICENSE +0 -0
@@ -7,7 +7,7 @@ from __future__ import annotations
7
7
  import typing
8
8
 
9
9
  from digitalhub.entities._commons.enums import EntityTypes
10
- from digitalhub.entities._processors.context import context_processor
10
+ from digitalhub.entities._processors.processors import context_processor
11
11
  from digitalhub.entities.artifact._base.entity import Artifact
12
12
  from digitalhub.entities.artifact.utils import eval_source, process_kwargs
13
13
  from digitalhub.utils.types import SourcesOrListOfSources
@@ -132,7 +132,6 @@ def get_artifact(
132
132
  identifier: str,
133
133
  project: str | None = None,
134
134
  entity_id: str | None = None,
135
- **kwargs,
136
135
  ) -> Artifact:
137
136
  """
138
137
  Get object from backend.
@@ -145,8 +144,6 @@ def get_artifact(
145
144
  Project name.
146
145
  entity_id : str
147
146
  Entity ID.
148
- **kwargs : dict
149
- Parameters to pass to the API call.
150
147
 
151
148
  Returns
152
149
  -------
@@ -168,14 +165,12 @@ def get_artifact(
168
165
  entity_type=ENTITY_TYPE,
169
166
  project=project,
170
167
  entity_id=entity_id,
171
- **kwargs,
172
168
  )
173
169
 
174
170
 
175
171
  def get_artifact_versions(
176
172
  identifier: str,
177
173
  project: str | None = None,
178
- **kwargs,
179
174
  ) -> list[Artifact]:
180
175
  """
181
176
  Get object versions from backend.
@@ -186,8 +181,6 @@ def get_artifact_versions(
186
181
  Entity key (store://...) or entity name.
187
182
  project : str
188
183
  Project name.
189
- **kwargs : dict
190
- Parameters to pass to the API call.
191
184
 
192
185
  Returns
193
186
  -------
@@ -207,11 +200,20 @@ def get_artifact_versions(
207
200
  identifier=identifier,
208
201
  entity_type=ENTITY_TYPE,
209
202
  project=project,
210
- **kwargs,
211
203
  )
212
204
 
213
205
 
214
- def list_artifacts(project: str, **kwargs) -> list[Artifact]:
206
+ def list_artifacts(
207
+ project: str,
208
+ q: str | None = None,
209
+ name: str | None = None,
210
+ kind: str | None = None,
211
+ user: str | None = None,
212
+ state: str | None = None,
213
+ created: str | None = None,
214
+ updated: str | None = None,
215
+ version: str | None = None,
216
+ ) -> list[Artifact]:
215
217
  """
216
218
  List all latest version objects from backend.
217
219
 
@@ -219,8 +221,22 @@ def list_artifacts(project: str, **kwargs) -> list[Artifact]:
219
221
  ----------
220
222
  project : str
221
223
  Project name.
222
- **kwargs : dict
223
- Parameters to pass to the API call.
224
+ q : str
225
+ Query string to filter objects.
226
+ name : str
227
+ Object name.
228
+ kind : str
229
+ Kind of the object.
230
+ user : str
231
+ User that created the object.
232
+ state : str
233
+ Object state.
234
+ created : str
235
+ Creation date filter.
236
+ updated : str
237
+ Update date filter.
238
+ version : str
239
+ Object version, default is latest.
224
240
 
225
241
  Returns
226
242
  -------
@@ -234,18 +250,36 @@ def list_artifacts(project: str, **kwargs) -> list[Artifact]:
234
250
  return context_processor.list_context_entities(
235
251
  project=project,
236
252
  entity_type=ENTITY_TYPE,
237
- **kwargs,
253
+ q=q,
254
+ name=name,
255
+ kind=kind,
256
+ user=user,
257
+ state=state,
258
+ created=created,
259
+ updated=updated,
260
+ version=version,
238
261
  )
239
262
 
240
263
 
241
- def import_artifact(file: str) -> Artifact:
264
+ def import_artifact(
265
+ file: str | None = None,
266
+ key: str | None = None,
267
+ reset_id: bool = False,
268
+ context: str | None = None,
269
+ ) -> Artifact:
242
270
  """
243
- Import object from a YAML file and create a new object into the backend.
271
+ Import an object from a YAML file or from a storage key.
244
272
 
245
273
  Parameters
246
274
  ----------
247
275
  file : str
248
- Path to YAML file.
276
+ Path to the YAML file.
277
+ key : str
278
+ Entity key (store://...).
279
+ reset_id : bool
280
+ Flag to determine if the ID of executable entities should be reset.
281
+ context : str
282
+ Project name to use for context resolution.
249
283
 
250
284
  Returns
251
285
  -------
@@ -256,7 +290,12 @@ def import_artifact(file: str) -> Artifact:
256
290
  --------
257
291
  >>> obj = import_artifact("my-artifact.yaml")
258
292
  """
259
- return context_processor.import_context_entity(file)
293
+ return context_processor.import_context_entity(
294
+ file,
295
+ key,
296
+ reset_id,
297
+ context,
298
+ )
260
299
 
261
300
 
262
301
  def load_artifact(file: str) -> Artifact:
@@ -312,7 +351,6 @@ def delete_artifact(
312
351
  entity_id: str | None = None,
313
352
  delete_all_versions: bool = False,
314
353
  cascade: bool = True,
315
- **kwargs,
316
354
  ) -> dict:
317
355
  """
318
356
  Delete object from backend.
@@ -326,11 +364,10 @@ def delete_artifact(
326
364
  entity_id : str
327
365
  Entity ID.
328
366
  delete_all_versions : bool
329
- Delete all versions of the named entity. If True, use entity name instead of entity key as identifier.
367
+ Delete all versions of the named entity.
368
+ If True, use entity name instead of entity key as identifier.
330
369
  cascade : bool
331
370
  Cascade delete.
332
- **kwargs : dict
333
- Parameters to pass to the API call.
334
371
 
335
372
  Returns
336
373
  -------
@@ -354,5 +391,4 @@ def delete_artifact(
354
391
  entity_id=entity_id,
355
392
  delete_all_versions=delete_all_versions,
356
393
  cascade=cascade,
357
- **kwargs,
358
394
  )
@@ -6,9 +6,9 @@ from __future__ import annotations
6
6
 
7
7
  from typing import Any
8
8
 
9
- from digitalhub.entities._base.entity._constructors.uuid import build_uuid
10
9
  from digitalhub.entities._base.material.utils import build_log_path_from_source, eval_local_source
11
10
  from digitalhub.entities._commons.enums import EntityTypes
11
+ from digitalhub.entities._constructors.uuid import build_uuid
12
12
 
13
13
 
14
14
  def eval_source(
@@ -23,7 +23,7 @@ def eval_source(
23
23
 
24
24
  Parameters
25
25
  ----------
26
- source : str, list[str], or None, optional
26
+ source : str, list[str], or None
27
27
  The source specification(s) to evaluate. Can be a single
28
28
  source string, a list of source strings, or None.
29
29
 
@@ -59,7 +59,7 @@ def process_kwargs(
59
59
  source : str or list[str]
60
60
  The source specification(s) for the artifact content.
61
61
  Can be a single source or multiple sources.
62
- path : str, optional
62
+ path : str
63
63
  The destination path for the artifact entity.
64
64
  If None, a path will be automatically generated.
65
65
  **kwargs : dict
@@ -8,7 +8,7 @@ import typing
8
8
  from typing import Any
9
9
 
10
10
  from digitalhub.entities._commons.enums import EntityTypes
11
- from digitalhub.entities._processors.context import context_processor
11
+ from digitalhub.entities._processors.processors import context_processor
12
12
  from digitalhub.entities.dataitem.utils import clean_tmp_path, eval_data, eval_source, post_process, process_kwargs
13
13
  from digitalhub.utils.types import SourcesOrListOfSources
14
14
 
@@ -87,6 +87,7 @@ def log_dataitem(
87
87
  data: Any | None = None,
88
88
  path: str | None = None,
89
89
  file_format: str | None = None,
90
+ read_df_params: dict | None = None,
90
91
  engine: str | None = "pandas",
91
92
  **kwargs,
92
93
  ) -> Dataitem:
@@ -108,7 +109,9 @@ def log_dataitem(
108
109
  path : str
109
110
  Destination path of the dataitem. If not provided, it's generated.
110
111
  file_format : str
111
- Extension of the file.
112
+ Extension of the file source (parquet, csv, json, xlsx, txt).
113
+ read_df_params : dict
114
+ Parameters to pass to the dataframe reader.
112
115
  engine : str
113
116
  Dataframe engine (pandas, polars, etc.).
114
117
  **kwargs : dict
@@ -131,7 +134,7 @@ def log_dataitem(
131
134
  cleanup = True
132
135
 
133
136
  source = eval_source(source, data, kind, name, project)
134
- data = eval_data(kind, source, data, file_format, engine)
137
+ data = eval_data(kind, source, data, file_format, read_df_params, engine)
135
138
  kwargs = process_kwargs(
136
139
  project,
137
140
  name,
@@ -158,7 +161,6 @@ def get_dataitem(
158
161
  identifier: str,
159
162
  project: str | None = None,
160
163
  entity_id: str | None = None,
161
- **kwargs,
162
164
  ) -> Dataitem:
163
165
  """
164
166
  Get object from backend.
@@ -171,8 +173,6 @@ def get_dataitem(
171
173
  Project name.
172
174
  entity_id : str
173
175
  Entity ID.
174
- **kwargs : dict
175
- Parameters to pass to the API call.
176
176
 
177
177
  Returns
178
178
  -------
@@ -194,14 +194,12 @@ def get_dataitem(
194
194
  entity_type=ENTITY_TYPE,
195
195
  project=project,
196
196
  entity_id=entity_id,
197
- **kwargs,
198
197
  )
199
198
 
200
199
 
201
200
  def get_dataitem_versions(
202
201
  identifier: str,
203
202
  project: str | None = None,
204
- **kwargs,
205
203
  ) -> list[Dataitem]:
206
204
  """
207
205
  Get object versions from backend.
@@ -212,8 +210,6 @@ def get_dataitem_versions(
212
210
  Entity key (store://...) or entity name.
213
211
  project : str
214
212
  Project name.
215
- **kwargs : dict
216
- Parameters to pass to the API call.
217
213
 
218
214
  Returns
219
215
  -------
@@ -233,11 +229,20 @@ def get_dataitem_versions(
233
229
  identifier=identifier,
234
230
  entity_type=ENTITY_TYPE,
235
231
  project=project,
236
- **kwargs,
237
232
  )
238
233
 
239
234
 
240
- def list_dataitems(project: str, **kwargs) -> list[Dataitem]:
235
+ def list_dataitems(
236
+ project: str,
237
+ q: str | None = None,
238
+ name: str | None = None,
239
+ kind: str | None = None,
240
+ user: str | None = None,
241
+ state: str | None = None,
242
+ created: str | None = None,
243
+ updated: str | None = None,
244
+ version: str | None = None,
245
+ ) -> list[Dataitem]:
241
246
  """
242
247
  List all latest version objects from backend.
243
248
 
@@ -245,8 +250,22 @@ def list_dataitems(project: str, **kwargs) -> list[Dataitem]:
245
250
  ----------
246
251
  project : str
247
252
  Project name.
248
- **kwargs : dict
249
- Parameters to pass to the API call.
253
+ q : str
254
+ Query string to filter objects.
255
+ name : str
256
+ Object name.
257
+ kind : str
258
+ Kind of the object.
259
+ user : str
260
+ User that created the object.
261
+ state : str
262
+ Object state.
263
+ created : str
264
+ Creation date filter.
265
+ updated : str
266
+ Update date filter.
267
+ version : str
268
+ Object version, default is latest.
250
269
 
251
270
  Returns
252
271
  -------
@@ -260,18 +279,36 @@ def list_dataitems(project: str, **kwargs) -> list[Dataitem]:
260
279
  return context_processor.list_context_entities(
261
280
  project=project,
262
281
  entity_type=ENTITY_TYPE,
263
- **kwargs,
282
+ q=q,
283
+ name=name,
284
+ kind=kind,
285
+ user=user,
286
+ state=state,
287
+ created=created,
288
+ updated=updated,
289
+ version=version,
264
290
  )
265
291
 
266
292
 
267
- def import_dataitem(file: str) -> Dataitem:
293
+ def import_dataitem(
294
+ file: str | None = None,
295
+ key: str | None = None,
296
+ reset_id: bool = False,
297
+ context: str | None = None,
298
+ ) -> Dataitem:
268
299
  """
269
- Import object from a YAML file and create a new object into the backend.
300
+ Import an object from a YAML file or from a storage key.
270
301
 
271
302
  Parameters
272
303
  ----------
273
304
  file : str
274
- Path to YAML file.
305
+ Path to the YAML file.
306
+ key : str
307
+ Entity key (store://...).
308
+ reset_id : bool
309
+ Flag to determine if the ID of executable entities should be reset.
310
+ context : str
311
+ Project name to use for context resolution.
275
312
 
276
313
  Returns
277
314
  -------
@@ -282,7 +319,12 @@ def import_dataitem(file: str) -> Dataitem:
282
319
  --------
283
320
  >>> obj = import_dataitem("my-dataitem.yaml")
284
321
  """
285
- return context_processor.import_context_entity(file)
322
+ return context_processor.import_context_entity(
323
+ file,
324
+ key,
325
+ reset_id,
326
+ context,
327
+ )
286
328
 
287
329
 
288
330
  def load_dataitem(file: str) -> Dataitem:
@@ -352,7 +394,8 @@ def delete_dataitem(
352
394
  entity_id : str
353
395
  Entity ID.
354
396
  delete_all_versions : bool
355
- Delete all versions of the named entity. If True, use entity name instead of entity key as identifier.
397
+ Delete all versions of the named entity.
398
+ If True, use entity name instead of entity key as identifier.
356
399
  cascade : bool
357
400
  Cascade delete.
358
401
  **kwargs : dict
@@ -4,9 +4,7 @@
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
- import shutil
8
7
  import typing
9
- from pathlib import Path
10
8
  from typing import Any
11
9
 
12
10
  from digitalhub.entities._base.material.utils import refresh_decorator
@@ -120,13 +118,17 @@ class DataitemTable(Dataitem):
120
118
  Write DataFrame as parquet/csv/table into dataitem spec.path.
121
119
  keyword arguments will be passed to the DataFrame reader function such as
122
120
  pandas's to_csv or to_parquet.
121
+ Note that by default the index is dropped when writing the dataframe. To
122
+ keep the index, you can pass index=True as a keyword argument.
123
+ If the dataitem path is a SQL scheme, the dataframe will be written to the
124
+ table specified in the path (sql://<database_name>(/<schema_name>)/<table_name>).
123
125
 
124
126
  Parameters
125
127
  ----------
126
128
  df : Any
127
129
  DataFrame to write.
128
130
  extension : str
129
- Extension of the file.
131
+ Extension of the file (supported parquet and csv).
130
132
  **kwargs : dict
131
133
  Keyword arguments passed to the write_df function.
132
134
 
@@ -134,6 +136,25 @@ class DataitemTable(Dataitem):
134
136
  -------
135
137
  str
136
138
  Path to the written dataframe.
139
+
140
+ Examples
141
+ --------
142
+ >>> import digitalhub as dh
143
+ >>> import pandas as pd
144
+ >>>
145
+ >>> p = dh.get_project("my_project")
146
+ >>> df = pd.read_df("data/my_data.csv")
147
+ >>> di = p.new_dataitem(
148
+ ... name="my_dataitem",
149
+ ... kind="table",
150
+ ... path="s3://my-bucket/my-data.parquet",
151
+ ... )
152
+ >>> di.write_df(
153
+ ... df,
154
+ ... extension="parquet",
155
+ ... index=True,
156
+ ... )
157
+ 's3://my-bucket/my-data.parquet'
137
158
  """
138
159
  return get_store(self.spec.path).write_df(
139
160
  df,
@@ -141,22 +162,3 @@ class DataitemTable(Dataitem):
141
162
  extension=extension,
142
163
  **kwargs,
143
164
  )
144
-
145
- @staticmethod
146
- def _clean_tmp_path(pth: Path | None, clean: bool) -> None:
147
- """
148
- Clean temporary path.
149
-
150
- Parameters
151
- ----------
152
- pth : Path | None
153
- Path to clean.
154
- clean : bool
155
- If True, the path will be cleaned.
156
-
157
- Returns
158
- -------
159
- None
160
- """
161
- if pth is not None and clean:
162
- shutil.rmtree(pth)
@@ -9,9 +9,9 @@ import typing
9
9
  from typing import Any
10
10
 
11
11
  from digitalhub.context.api import get_context
12
- from digitalhub.entities._base.entity._constructors.uuid import build_uuid
13
12
  from digitalhub.entities._base.material.utils import build_log_path_from_source, eval_local_source
14
13
  from digitalhub.entities._commons.enums import EntityKinds, EntityTypes
14
+ from digitalhub.entities._constructors.uuid import build_uuid
15
15
  from digitalhub.stores.data.api import get_store
16
16
  from digitalhub.stores.readers.data.api import get_reader_by_object
17
17
  from digitalhub.utils.enums import FileExtensions
@@ -41,17 +41,17 @@ def eval_source(
41
41
 
42
42
  Parameters
43
43
  ----------
44
- source : SourcesOrListOfSources, optional
44
+ source : SourcesOrListOfSources
45
45
  The source specification(s) for the dataitem. Can be file paths,
46
46
  URLs, or other source identifiers.
47
- data : Any, optional
47
+ data : Any
48
48
  The data object to process (e.g., DataFrame). Alternative to source.
49
49
  Exactly one of source or data must be provided.
50
- kind : str, optional
50
+ kind : str
51
51
  The kind of dataitem being created (e.g., 'table').
52
- name : str, optional
52
+ name : str
53
53
  The name of the dataitem, used for generating file paths.
54
- project : str, optional
54
+ project : str
55
55
  The project name, used for context and path generation.
56
56
 
57
57
  Returns
@@ -89,6 +89,7 @@ def eval_data(
89
89
  source: SourcesOrListOfSources,
90
90
  data: Any | None = None,
91
91
  file_format: str | None = None,
92
+ read_df_params: dict | None = None,
92
93
  engine: str | None = None,
93
94
  ) -> Any:
94
95
  """
@@ -104,13 +105,13 @@ def eval_data(
104
105
  how data should be processed.
105
106
  source : SourcesOrListOfSources
106
107
  The source specification(s) to load data from.
107
- data : Any, optional
108
+ data : Any
108
109
  Pre-loaded data object. If provided, may be returned directly
109
110
  depending on the dataitem kind.
110
- file_format : str, optional
111
+ file_format : str
111
112
  The file format specification for reading the source
112
113
  (e.g., 'parquet', 'csv').
113
- engine : str, optional
114
+ engine : str
114
115
  The engine to use for reading the data (e.g., 'pandas', 'polars').
115
116
 
116
117
  Returns
@@ -121,10 +122,13 @@ def eval_data(
121
122
  """
122
123
  if kind == EntityKinds.DATAITEM_TABLE.value:
123
124
  if data is None:
125
+ if read_df_params is None:
126
+ read_df_params = {}
124
127
  return get_store(source).read_df(
125
128
  source,
126
129
  file_format=file_format,
127
130
  engine=engine,
131
+ **read_df_params,
128
132
  )
129
133
  return data
130
134
 
@@ -155,10 +159,10 @@ def process_kwargs(
155
159
  The kind of dataitem being created (e.g., 'table').
156
160
  source : SourcesOrListOfSources
157
161
  The source specification(s) for the dataitem content.
158
- data : Any, optional
162
+ data : Any
159
163
  The data object for schema extraction and processing.
160
164
  Used as an alternative to source for table dataitems.
161
- path : str, optional
165
+ path : str
162
166
  The destination path for the dataitem entity.
163
167
  If None, a path will be automatically generated.
164
168
  **kwargs : dict
@@ -197,10 +201,6 @@ def clean_tmp_path(pth: SourcesOrListOfSources) -> None:
197
201
  pth : SourcesOrListOfSources
198
202
  The path or list of paths to clean up. Can be file paths
199
203
  or directory paths that need to be removed.
200
-
201
- Returns
202
- -------
203
- None
204
204
  """
205
205
  if isinstance(pth, list):
206
206
  for p in pth:
@@ -9,7 +9,7 @@ from concurrent.futures import ThreadPoolExecutor
9
9
 
10
10
  from digitalhub.entities._base.executable.entity import ExecutableEntity
11
11
  from digitalhub.entities._commons.enums import EntityTypes, Relationship
12
- from digitalhub.factory.factory import factory
12
+ from digitalhub.factory.entity import entity_factory
13
13
  from digitalhub.utils.exceptions import BackendError
14
14
 
15
15
  if typing.TYPE_CHECKING:
@@ -76,8 +76,8 @@ class Function(ExecutableEntity):
76
76
  Run instance.
77
77
  """
78
78
  # Get task and run kind
79
- task_kind = factory.get_task_kind_from_action(self.kind, action)
80
- run_kind = factory.get_run_kind(self.kind)
79
+ task_kind = entity_factory.get_task_kind_from_action(self.kind, action)
80
+ run_kind = entity_factory.get_run_kind_from_action(self.kind, action)
81
81
 
82
82
  # Create or update new task
83
83
  task = self._get_or_create_task(task_kind)