digitalhub 0.14.0b1__py3-none-any.whl → 0.14.0b3__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 (71) hide show
  1. digitalhub/context/builder.py +0 -4
  2. digitalhub/context/context.py +12 -8
  3. digitalhub/entities/_base/_base/entity.py +0 -4
  4. digitalhub/entities/_base/context/entity.py +1 -1
  5. digitalhub/entities/_base/entity/entity.py +0 -8
  6. digitalhub/entities/_base/executable/entity.py +9 -21
  7. digitalhub/entities/_base/material/entity.py +5 -21
  8. digitalhub/entities/_base/unversioned/entity.py +1 -1
  9. digitalhub/entities/_base/versioned/entity.py +1 -1
  10. digitalhub/entities/_processors/base/__init__.py +3 -0
  11. digitalhub/entities/_processors/{base.py → base/crud.py} +12 -232
  12. digitalhub/entities/_processors/base/import_export.py +122 -0
  13. digitalhub/entities/_processors/base/processor.py +302 -0
  14. digitalhub/entities/_processors/base/special_ops.py +108 -0
  15. digitalhub/entities/_processors/context/__init__.py +3 -0
  16. digitalhub/entities/_processors/context/crud.py +654 -0
  17. digitalhub/entities/_processors/context/import_export.py +242 -0
  18. digitalhub/entities/_processors/context/material.py +123 -0
  19. digitalhub/entities/_processors/context/processor.py +400 -0
  20. digitalhub/entities/_processors/context/special_ops.py +476 -0
  21. digitalhub/entities/_processors/processors.py +12 -0
  22. digitalhub/entities/_processors/utils.py +2 -2
  23. digitalhub/entities/artifact/crud.py +1 -1
  24. digitalhub/entities/dataitem/crud.py +6 -3
  25. digitalhub/entities/dataitem/table/entity.py +24 -1
  26. digitalhub/entities/dataitem/utils.py +4 -0
  27. digitalhub/entities/function/_base/entity.py +3 -3
  28. digitalhub/entities/function/crud.py +1 -1
  29. digitalhub/entities/model/_base/entity.py +46 -24
  30. digitalhub/entities/model/crud.py +1 -1
  31. digitalhub/entities/project/_base/entity.py +3 -12
  32. digitalhub/entities/project/crud.py +1 -2
  33. digitalhub/entities/run/_base/builder.py +0 -4
  34. digitalhub/entities/run/_base/entity.py +53 -66
  35. digitalhub/entities/run/crud.py +5 -2
  36. digitalhub/entities/secret/_base/entity.py +1 -5
  37. digitalhub/entities/secret/crud.py +1 -1
  38. digitalhub/entities/task/_base/builder.py +0 -4
  39. digitalhub/entities/task/_base/entity.py +5 -5
  40. digitalhub/entities/task/crud.py +1 -1
  41. digitalhub/entities/trigger/_base/entity.py +1 -5
  42. digitalhub/entities/trigger/crud.py +1 -1
  43. digitalhub/entities/workflow/_base/entity.py +3 -3
  44. digitalhub/entities/workflow/crud.py +1 -1
  45. digitalhub/factory/entity.py +283 -0
  46. digitalhub/factory/registry.py +197 -0
  47. digitalhub/factory/runtime.py +44 -0
  48. digitalhub/runtimes/_base.py +2 -2
  49. digitalhub/stores/client/dhcore/client.py +0 -14
  50. digitalhub/stores/client/dhcore/configurator.py +5 -28
  51. digitalhub/stores/client/dhcore/error_parser.py +0 -4
  52. digitalhub/stores/credentials/configurator.py +4 -29
  53. digitalhub/stores/credentials/handler.py +0 -12
  54. digitalhub/stores/credentials/store.py +0 -4
  55. digitalhub/stores/data/_base/store.py +0 -16
  56. digitalhub/stores/data/builder.py +0 -4
  57. digitalhub/stores/data/remote/store.py +0 -4
  58. digitalhub/stores/data/s3/configurator.py +2 -10
  59. digitalhub/stores/data/s3/store.py +0 -12
  60. digitalhub/stores/data/sql/configurator.py +0 -8
  61. digitalhub/stores/data/sql/store.py +0 -4
  62. digitalhub/stores/readers/data/factory.py +0 -8
  63. digitalhub/stores/readers/data/pandas/reader.py +9 -19
  64. digitalhub/utils/io_utils.py +0 -4
  65. {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/METADATA +1 -1
  66. {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/RECORD +69 -57
  67. digitalhub/entities/_processors/context.py +0 -1499
  68. digitalhub/factory/factory.py +0 -460
  69. {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/WHEEL +0 -0
  70. {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/licenses/AUTHORS +0 -0
  71. {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,476 @@
1
+ # SPDX-FileCopyrightText: © 2025 DSLab - Fondazione Bruno Kessler
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from __future__ import annotations
6
+
7
+ import typing
8
+ from typing import Any
9
+
10
+ from digitalhub.entities._commons.enums import ApiCategories, BackendOperations
11
+ from digitalhub.entities._processors.utils import get_context_from_project
12
+
13
+ if typing.TYPE_CHECKING:
14
+ from digitalhub.entities._base.context.entity import ContextEntity
15
+ from digitalhub.entities._processors.context.crud import ContextEntityCRUDProcessor
16
+
17
+
18
+ class ContextEntitySpecialOpsProcessor:
19
+ """
20
+ Processor for specialized context entity operations.
21
+
22
+ Handles backend operations like secrets management, logging,
23
+ entity control (start/stop/resume), file operations, and metrics.
24
+ """
25
+
26
+ def build_context_entity_key(
27
+ self,
28
+ project: str,
29
+ entity_type: str,
30
+ entity_kind: str,
31
+ entity_name: str,
32
+ entity_id: str | None = None,
33
+ ) -> str:
34
+ """
35
+ Build a storage key for a context entity.
36
+
37
+ Creates a standardized key string for context entity identification
38
+ and storage, resolving the project context automatically.
39
+
40
+ Parameters
41
+ ----------
42
+ project : str
43
+ The project name containing the entity.
44
+ entity_type : str
45
+ The type of entity.
46
+ entity_kind : str
47
+ The kind/subtype of entity.
48
+ entity_name : str
49
+ The name of the entity.
50
+ entity_id : str, optional
51
+ The unique identifier of the entity version.
52
+
53
+ Returns
54
+ -------
55
+ str
56
+ The constructed context entity key string.
57
+ """
58
+ context = get_context_from_project(project)
59
+ return context.client.build_key(
60
+ ApiCategories.CONTEXT.value,
61
+ project=context.name,
62
+ entity_type=entity_type,
63
+ entity_kind=entity_kind,
64
+ entity_name=entity_name,
65
+ entity_id=entity_id,
66
+ )
67
+
68
+ def read_secret_data(
69
+ self,
70
+ project: str,
71
+ entity_type: str,
72
+ **kwargs,
73
+ ) -> dict:
74
+ """
75
+ Read secret data from the backend.
76
+
77
+ Retrieves secret data stored in the backend for a specific
78
+ project and entity type.
79
+
80
+ Parameters
81
+ ----------
82
+ project : str
83
+ The project name containing the secrets.
84
+ entity_type : str
85
+ The type of entity (typically 'secret').
86
+ **kwargs : dict
87
+ Additional parameters to pass to the API call.
88
+
89
+ Returns
90
+ -------
91
+ dict
92
+ Secret data retrieved from the backend.
93
+ """
94
+ context = get_context_from_project(project)
95
+ api = context.client.build_api(
96
+ ApiCategories.CONTEXT.value,
97
+ BackendOperations.DATA.value,
98
+ project=context.name,
99
+ entity_type=entity_type,
100
+ )
101
+ return context.client.read_object(api, **kwargs)
102
+
103
+ def update_secret_data(
104
+ self,
105
+ project: str,
106
+ entity_type: str,
107
+ data: dict,
108
+ **kwargs,
109
+ ) -> None:
110
+ """
111
+ Update secret data in the backend.
112
+
113
+ Stores or updates secret data in the backend for a specific
114
+ project and entity type.
115
+
116
+ Parameters
117
+ ----------
118
+ project : str
119
+ The project name to store secrets in.
120
+ entity_type : str
121
+ The type of entity (typically 'secret').
122
+ data : dict
123
+ The secret data dictionary to store.
124
+ **kwargs : dict
125
+ Additional parameters to pass to the API call.
126
+ """
127
+ context = get_context_from_project(project)
128
+ api = context.client.build_api(
129
+ ApiCategories.CONTEXT.value,
130
+ BackendOperations.DATA.value,
131
+ project=context.name,
132
+ entity_type=entity_type,
133
+ )
134
+ context.client.update_object(api, data, **kwargs)
135
+
136
+ def read_run_logs(
137
+ self,
138
+ project: str,
139
+ entity_type: str,
140
+ entity_id: str,
141
+ **kwargs,
142
+ ) -> dict:
143
+ """
144
+ Read execution logs from the backend.
145
+
146
+ Retrieves logs for a specific run or task execution from
147
+ the backend.
148
+
149
+ Parameters
150
+ ----------
151
+ project : str
152
+ The project name containing the entity.
153
+ entity_type : str
154
+ The type of entity (typically 'run' or 'task').
155
+ entity_id : str
156
+ The unique identifier of the entity to get logs for.
157
+ **kwargs : dict
158
+ Additional parameters to pass to the API call.
159
+
160
+ Returns
161
+ -------
162
+ dict
163
+ Log data retrieved from the backend.
164
+ """
165
+ context = get_context_from_project(project)
166
+ api = context.client.build_api(
167
+ ApiCategories.CONTEXT.value,
168
+ BackendOperations.LOGS.value,
169
+ project=context.name,
170
+ entity_type=entity_type,
171
+ entity_id=entity_id,
172
+ )
173
+ return context.client.read_object(api, **kwargs)
174
+
175
+ def stop_entity(
176
+ self,
177
+ project: str,
178
+ entity_type: str,
179
+ entity_id: str,
180
+ **kwargs,
181
+ ) -> None:
182
+ """
183
+ Stop a running entity in the backend.
184
+
185
+ Sends a stop signal to halt execution of a running entity
186
+ such as a workflow or long-running task.
187
+
188
+ Parameters
189
+ ----------
190
+ project : str
191
+ The project name containing the entity.
192
+ entity_type : str
193
+ The type of entity to stop.
194
+ entity_id : str
195
+ The unique identifier of the entity to stop.
196
+ **kwargs : dict
197
+ Additional parameters to pass to the API call.
198
+ """
199
+ context = get_context_from_project(project)
200
+ api = context.client.build_api(
201
+ ApiCategories.CONTEXT.value,
202
+ BackendOperations.STOP.value,
203
+ project=context.name,
204
+ entity_type=entity_type,
205
+ entity_id=entity_id,
206
+ )
207
+ context.client.create_object(api, **kwargs)
208
+
209
+ def resume_entity(
210
+ self,
211
+ project: str,
212
+ entity_type: str,
213
+ entity_id: str,
214
+ **kwargs,
215
+ ) -> None:
216
+ """
217
+ Resume a stopped entity in the backend.
218
+
219
+ Sends a resume signal to restart execution of a previously
220
+ stopped entity such as a workflow or task.
221
+
222
+ Parameters
223
+ ----------
224
+ project : str
225
+ The project name containing the entity.
226
+ entity_type : str
227
+ The type of entity to resume.
228
+ entity_id : str
229
+ The unique identifier of the entity to resume.
230
+ **kwargs : dict
231
+ Additional parameters to pass to the API call.
232
+ """
233
+ context = get_context_from_project(project)
234
+ api = context.client.build_api(
235
+ ApiCategories.CONTEXT.value,
236
+ BackendOperations.RESUME.value,
237
+ project=context.name,
238
+ entity_type=entity_type,
239
+ entity_id=entity_id,
240
+ )
241
+ context.client.create_object(api, **kwargs)
242
+
243
+ def read_files_info(
244
+ self,
245
+ project: str,
246
+ entity_type: str,
247
+ entity_id: str,
248
+ **kwargs,
249
+ ) -> list[dict]:
250
+ """
251
+ Read file information from the backend.
252
+
253
+ Retrieves metadata about files associated with an entity,
254
+ including file paths, sizes, and other attributes.
255
+
256
+ Parameters
257
+ ----------
258
+ project : str
259
+ The project name containing the entity.
260
+ entity_type : str
261
+ The type of entity to get file info for.
262
+ entity_id : str
263
+ The unique identifier of the entity.
264
+ **kwargs : dict
265
+ Additional parameters to pass to the API call.
266
+
267
+ Returns
268
+ -------
269
+ list[dict]
270
+ List of file information dictionaries from the backend.
271
+ """
272
+ context = get_context_from_project(project)
273
+ api = context.client.build_api(
274
+ ApiCategories.CONTEXT.value,
275
+ BackendOperations.FILES.value,
276
+ project=context.name,
277
+ entity_type=entity_type,
278
+ entity_id=entity_id,
279
+ )
280
+ return context.client.read_object(api, **kwargs)
281
+
282
+ def update_files_info(
283
+ self,
284
+ project: str,
285
+ entity_type: str,
286
+ entity_id: str,
287
+ entity_list: list[dict],
288
+ **kwargs,
289
+ ) -> None:
290
+ """
291
+ Get files info from backend.
292
+
293
+ Parameters
294
+ ----------
295
+ project : str
296
+ Project name.
297
+ entity_type : str
298
+ Entity type.
299
+ entity_id : str
300
+ Entity ID.
301
+ entity_list : list[dict]
302
+ Entity list.
303
+ **kwargs : dict
304
+ Parameters to pass to the API call.
305
+ """
306
+ context = get_context_from_project(project)
307
+ api = context.client.build_api(
308
+ ApiCategories.CONTEXT.value,
309
+ BackendOperations.FILES.value,
310
+ project=context.name,
311
+ entity_type=entity_type,
312
+ entity_id=entity_id,
313
+ )
314
+ return context.client.update_object(api, entity_list, **kwargs)
315
+
316
+ def read_metrics(
317
+ self,
318
+ project: str,
319
+ entity_type: str,
320
+ entity_id: str,
321
+ metric_name: str | None = None,
322
+ **kwargs,
323
+ ) -> dict:
324
+ """
325
+ Read metrics from the backend for a specific entity.
326
+
327
+ Retrieves metrics data associated with an entity. Can fetch either
328
+ all metrics or a specific metric by name. Used for performance
329
+ monitoring and analysis of entity operations.
330
+
331
+ Parameters
332
+ ----------
333
+ project : str
334
+ The project name containing the entity.
335
+ entity_type : str
336
+ The type of entity to read metrics from.
337
+ entity_id : str
338
+ The unique identifier of the entity.
339
+ metric_name : str, optional
340
+ The name of a specific metric to retrieve.
341
+ If None, retrieves all available metrics.
342
+ **kwargs : dict
343
+ Additional parameters to pass to the API call.
344
+
345
+ Returns
346
+ -------
347
+ dict
348
+ Dictionary containing metric data from the backend.
349
+ """
350
+ context = get_context_from_project(project)
351
+ api = context.client.build_api(
352
+ ApiCategories.CONTEXT.value,
353
+ BackendOperations.METRICS.value,
354
+ project=context.name,
355
+ entity_type=entity_type,
356
+ entity_id=entity_id,
357
+ metric_name=metric_name,
358
+ )
359
+ return context.client.read_object(api, **kwargs)
360
+
361
+ def update_metric(
362
+ self,
363
+ project: str,
364
+ entity_type: str,
365
+ entity_id: str,
366
+ metric_name: str,
367
+ metric_value: Any,
368
+ **kwargs,
369
+ ) -> None:
370
+ """
371
+ Update or create a metric value for an entity in the backend.
372
+
373
+ Updates an existing metric or creates a new one with the specified
374
+ value. Metrics are used for tracking performance, status, and
375
+ other quantitative aspects of entity operations.
376
+
377
+ Parameters
378
+ ----------
379
+ project : str
380
+ The project name containing the entity.
381
+ entity_type : str
382
+ The type of entity to update metrics for.
383
+ entity_id : str
384
+ The unique identifier of the entity.
385
+ metric_name : str
386
+ The name of the metric to update or create.
387
+ metric_value : Any
388
+ The value to set for the metric.
389
+ Can be numeric, string, or other supported types.
390
+ **kwargs : dict
391
+ Additional parameters to pass to the API call.
392
+ """
393
+ context = get_context_from_project(project)
394
+ api = context.client.build_api(
395
+ ApiCategories.CONTEXT.value,
396
+ BackendOperations.METRICS.value,
397
+ project=context.name,
398
+ entity_type=entity_type,
399
+ entity_id=entity_id,
400
+ metric_name=metric_name,
401
+ )
402
+ context.client.update_object(api, metric_value, **kwargs)
403
+
404
+ def search_entity(
405
+ self,
406
+ crud_processor: ContextEntityCRUDProcessor,
407
+ project: str,
408
+ query: str | None = None,
409
+ entity_types: list[str] | None = None,
410
+ name: str | None = None,
411
+ kind: str | None = None,
412
+ created: str | None = None,
413
+ updated: str | None = None,
414
+ description: str | None = None,
415
+ labels: list[str] | None = None,
416
+ **kwargs,
417
+ ) -> list[ContextEntity]:
418
+ """
419
+ Search for entities in the backend using various criteria.
420
+
421
+ Performs a flexible search across multiple entity attributes,
422
+ allowing for complex queries and filtering. Returns matching
423
+ entities from the project context.
424
+
425
+ Parameters
426
+ ----------
427
+ crud_processor : ContextEntityCRUDProcessor
428
+ The CRUD processor instance for entity operations.
429
+ project : str
430
+ The project name to search within.
431
+ query : str, optional
432
+ Free-text search query to match against entity content.
433
+ entity_types : list[str], optional
434
+ List of entity types to filter by.
435
+ If None, searches all entity types.
436
+ name : str, optional
437
+ Entity name pattern to match.
438
+ kind : str, optional
439
+ Entity kind to filter by.
440
+ created : str, optional
441
+ Creation date filter (ISO format).
442
+ updated : str, optional
443
+ Last update date filter (ISO format).
444
+ description : str, optional
445
+ Description pattern to match.
446
+ labels : list[str], optional
447
+ List of label patterns to match.
448
+ **kwargs : dict
449
+ Additional search parameters to pass to the API call.
450
+
451
+ Returns
452
+ -------
453
+ list[ContextEntity]
454
+ List of matching entity instances from the search.
455
+ """
456
+ context = get_context_from_project(project)
457
+ kwargs = context.client.build_parameters(
458
+ ApiCategories.CONTEXT.value,
459
+ BackendOperations.SEARCH.value,
460
+ query=query,
461
+ entity_types=entity_types,
462
+ name=name,
463
+ kind=kind,
464
+ created=created,
465
+ updated=updated,
466
+ description=description,
467
+ labels=labels,
468
+ **kwargs,
469
+ )
470
+ api = context.client.build_api(
471
+ ApiCategories.CONTEXT.value,
472
+ BackendOperations.SEARCH.value,
473
+ project=context.name,
474
+ )
475
+ entities_dict = context.client.read_object(api, **kwargs)
476
+ return [crud_processor.read_context_entity(entity["key"]) for entity in entities_dict["content"]]
@@ -0,0 +1,12 @@
1
+ # SPDX-FileCopyrightText: © 2025 DSLab - Fondazione Bruno Kessler
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from digitalhub.entities._processors.base.processor import BaseEntityOperationsProcessor
6
+ from digitalhub.entities._processors.context.processor import ContextEntityOperationsProcessor
7
+
8
+ # Base processor singleton instance
9
+ base_processor = BaseEntityOperationsProcessor()
10
+
11
+ # Context processor singleton instance
12
+ context_processor = ContextEntityOperationsProcessor()
@@ -9,7 +9,7 @@ import typing
9
9
  from digitalhub.context.api import get_context
10
10
  from digitalhub.entities._commons.enums import ApiCategories, BackendOperations, EntityTypes
11
11
  from digitalhub.entities._commons.utils import get_project_from_key, is_valid_key, parse_entity_key
12
- from digitalhub.factory.factory import factory
12
+ from digitalhub.factory.entity import entity_factory
13
13
  from digitalhub.stores.client.api import get_client
14
14
  from digitalhub.utils.exceptions import ContextError, EntityError, EntityNotExistsError
15
15
 
@@ -161,7 +161,7 @@ def get_context_from_remote(
161
161
  try:
162
162
  client = get_client()
163
163
  obj = _read_base_entity(client, EntityTypes.PROJECT.value, project)
164
- factory.build_entity_from_dict(obj)
164
+ entity_factory.build_entity_from_dict(obj)
165
165
  return get_context(project)
166
166
  except EntityNotExistsError:
167
167
  raise ContextError(f"Project '{project}' not found.")
@@ -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
@@ -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,
@@ -115,13 +115,17 @@ class DataitemTable(Dataitem):
115
115
  Write DataFrame as parquet/csv/table into dataitem spec.path.
116
116
  keyword arguments will be passed to the DataFrame reader function such as
117
117
  pandas's to_csv or to_parquet.
118
+ Note that by default the index is dropped when writing the dataframe. To
119
+ keep the index, you can pass index=True as a keyword argument.
120
+ If the dataitem path is a SQL scheme, the dataframe will be written to the
121
+ table specified in the path (sql://<database_name>(/<schema_name>)/<table_name>).
118
122
 
119
123
  Parameters
120
124
  ----------
121
125
  df : Any
122
126
  DataFrame to write.
123
127
  extension : str
124
- Extension of the file.
128
+ Extension of the file (supported parquet and csv).
125
129
  **kwargs : dict
126
130
  Keyword arguments passed to the write_df function.
127
131
 
@@ -129,6 +133,25 @@ class DataitemTable(Dataitem):
129
133
  -------
130
134
  str
131
135
  Path to the written dataframe.
136
+
137
+ Examples
138
+ --------
139
+ >>> import digitalhub as dh
140
+ >>> import pandas as pd
141
+ >>>
142
+ >>> p = dh.get_project("my_project")
143
+ >>> df = pd.read_df("data/my_data.csv")
144
+ >>> di = p.new_dataitem(
145
+ ... name="my_dataitem",
146
+ ... kind="table",
147
+ ... path="s3://my-bucket/my-data.parquet",
148
+ ... )
149
+ >>> di.write_df(
150
+ ... df,
151
+ ... extension="parquet",
152
+ ... index=True,
153
+ ... )
154
+ 's3://my-bucket/my-data.parquet'
132
155
  """
133
156
  return get_store(self.spec.path).write_df(
134
157
  df,
@@ -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
  """
@@ -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
 
@@ -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_from_action(self.kind, action)
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)
@@ -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
 
12
12
  if typing.TYPE_CHECKING:
13
13
  from digitalhub.entities.function._base.entity import Function