digitalhub 0.13.0b3__py3-none-any.whl → 0.13.0b4__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.

@@ -20,11 +20,12 @@ if typing.TYPE_CHECKING:
20
20
 
21
21
  class BaseEntityOperationsProcessor:
22
22
  """
23
- Processor for Base Entity operations.
23
+ Processor for base entity operations.
24
24
 
25
- This object interacts with the context, check the category of the object,
26
- and then calls the appropriate method to perform the requested operation.
27
- Operations can be CRUD, search, list, etc.
25
+ This class handles CRUD operations and other entity management tasks
26
+ for base-level entities (primarily projects). It interacts with the
27
+ client layer to perform backend operations and manages entity lifecycle
28
+ including creation, reading, updating, deletion, and sharing.
28
29
  """
29
30
 
30
31
  ##############################
@@ -39,23 +40,26 @@ class BaseEntityOperationsProcessor:
39
40
  **kwargs,
40
41
  ) -> dict:
41
42
  """
42
- Create object in backend.
43
+ Create a base entity in the backend.
44
+
45
+ Builds the appropriate API endpoint and sends a create request
46
+ to the backend for base-level entities.
43
47
 
44
48
  Parameters
45
49
  ----------
46
50
  client : Client
47
- Client instance.
51
+ The client instance to use for the API call.
48
52
  entity_type : str
49
- Entity type.
53
+ The type of entity to create (e.g., 'project').
50
54
  entity_dict : dict
51
- Object instance.
55
+ The entity data dictionary to create.
52
56
  **kwargs : dict
53
- Parameters to pass to the API call.
57
+ Additional parameters to pass to the API call.
54
58
 
55
59
  Returns
56
60
  -------
57
61
  dict
58
- Object instance.
62
+ The created entity data returned from the backend.
59
63
  """
60
64
  api = client.build_api(
61
65
  ApiCategories.BASE.value,
@@ -70,19 +74,25 @@ class BaseEntityOperationsProcessor:
70
74
  **kwargs,
71
75
  ) -> Project:
72
76
  """
73
- Create object in backend.
77
+ Create a project entity in the backend.
78
+
79
+ Creates a new project either from an existing entity object or
80
+ by building one from the provided parameters. Handles both
81
+ local and remote backend creation.
74
82
 
75
83
  Parameters
76
84
  ----------
77
- _entity : Project
78
- Object instance.
85
+ _entity : Project, optional
86
+ An existing project entity object to create. If None,
87
+ a new entity will be built from kwargs.
79
88
  **kwargs : dict
80
- Parameters to pass to entity builder.
89
+ Parameters for entity creation, including 'local' flag
90
+ and entity-specific parameters.
81
91
 
82
92
  Returns
83
93
  -------
84
94
  Project
85
- Object instance.
95
+ The created project entity with backend data populated.
86
96
  """
87
97
  if _entity is not None:
88
98
  client = _entity._client
@@ -102,23 +112,26 @@ class BaseEntityOperationsProcessor:
102
112
  **kwargs,
103
113
  ) -> dict:
104
114
  """
105
- Read object from backend.
115
+ Read a base entity from the backend.
116
+
117
+ Builds the appropriate API endpoint and sends a read request
118
+ to retrieve entity data from the backend.
106
119
 
107
120
  Parameters
108
121
  ----------
109
122
  client : Client
110
- Client instance.
123
+ The client instance to use for the API call.
111
124
  entity_type : str
112
- Entity type.
125
+ The type of entity to read (e.g., 'project').
113
126
  entity_name : str
114
- Entity name.
127
+ The name identifier of the entity to read.
115
128
  **kwargs : dict
116
- Parameters to pass to the API call.
129
+ Additional parameters to pass to the API call.
117
130
 
118
131
  Returns
119
132
  -------
120
133
  dict
121
- Object instance.
134
+ The entity data retrieved from the backend.
122
135
  """
123
136
  api = client.build_api(
124
137
  ApiCategories.BASE.value,
@@ -135,21 +148,25 @@ class BaseEntityOperationsProcessor:
135
148
  **kwargs,
136
149
  ) -> Project:
137
150
  """
138
- Read object from backend.
151
+ Read a project entity from the backend.
152
+
153
+ Retrieves project data from the backend and constructs a
154
+ Project entity object with the retrieved data.
139
155
 
140
156
  Parameters
141
157
  ----------
142
158
  entity_type : str
143
- Entity type.
159
+ The type of entity to read (typically 'project').
144
160
  entity_name : str
145
- Entity name.
161
+ The name identifier of the project to read.
146
162
  **kwargs : dict
147
- Parameters to pass to entity builder.
163
+ Additional parameters including 'local' flag and
164
+ API call parameters.
148
165
 
149
166
  Returns
150
167
  -------
151
168
  Project
152
- Object instance.
169
+ The project entity object populated with backend data.
153
170
  """
154
171
  client = get_client(kwargs.pop("local", False))
155
172
  obj = self._read_base_entity(client, entity_type, entity_name, **kwargs)
@@ -162,19 +179,28 @@ class BaseEntityOperationsProcessor:
162
179
  **kwargs,
163
180
  ) -> Project:
164
181
  """
165
- Import object from a YAML file and create a new object into the backend.
182
+ Import a project entity from a YAML file and create it in the backend.
183
+
184
+ Reads project configuration from a YAML file, creates a new project
185
+ entity in the backend, and imports any related entities defined
186
+ in the file. Raises an error if the project already exists.
166
187
 
167
188
  Parameters
168
189
  ----------
169
190
  file : str
170
- Path to YAML file.
191
+ Path to the YAML file containing project configuration.
171
192
  **kwargs : dict
172
- Additional keyword arguments.
193
+ Additional parameters including 'local' flag.
173
194
 
174
195
  Returns
175
196
  -------
176
197
  Project
177
- Object instance.
198
+ The imported and created project entity.
199
+
200
+ Raises
201
+ ------
202
+ EntityError
203
+ If the project already exists in the backend.
178
204
  """
179
205
  client = get_client(kwargs.pop("local", False))
180
206
  obj: dict = read_yaml(file)
@@ -198,19 +224,23 @@ class BaseEntityOperationsProcessor:
198
224
  **kwargs,
199
225
  ) -> Project:
200
226
  """
201
- Load object from a YAML file and update an existing object into the backend.
227
+ Load a project entity from a YAML file and update it in the backend.
228
+
229
+ Reads project configuration from a YAML file and updates an existing
230
+ project in the backend. If the project doesn't exist, it creates a
231
+ new one. Also loads any related entities defined in the file.
202
232
 
203
233
  Parameters
204
234
  ----------
205
235
  file : str
206
- Path to YAML file.
236
+ Path to the YAML file containing project configuration.
207
237
  **kwargs : dict
208
- Additional keyword arguments.
238
+ Additional parameters including 'local' flag.
209
239
 
210
240
  Returns
211
241
  -------
212
242
  Project
213
- Object instance.
243
+ The loaded and updated project entity.
214
244
  """
215
245
  client = get_client(kwargs.pop("local", False))
216
246
  obj: dict = read_yaml(file)
@@ -234,21 +264,25 @@ class BaseEntityOperationsProcessor:
234
264
  **kwargs,
235
265
  ) -> list[dict]:
236
266
  """
237
- List objects from backend.
267
+ List base entities from the backend.
268
+
269
+ Builds the appropriate API endpoint and sends a list request
270
+ to retrieve multiple entities from the backend.
238
271
 
239
272
  Parameters
240
273
  ----------
241
274
  client : Client
242
- Client instance.
275
+ The client instance to use for the API call.
243
276
  entity_type : str
244
- Entity type.
277
+ The type of entities to list (e.g., 'project').
245
278
  **kwargs : dict
246
- Parameters to pass to the API call.
279
+ Additional parameters to pass to the API call for filtering
280
+ or pagination.
247
281
 
248
282
  Returns
249
283
  -------
250
284
  list[dict]
251
- List of objects.
285
+ List of entity data dictionaries from the backend.
252
286
  """
253
287
  api = client.build_api(
254
288
  ApiCategories.BASE.value,
@@ -263,19 +297,23 @@ class BaseEntityOperationsProcessor:
263
297
  **kwargs,
264
298
  ) -> list[Project]:
265
299
  """
266
- List objects from backend.
300
+ List project entities from the backend.
301
+
302
+ Retrieves a list of projects from the backend and converts
303
+ them to Project entity objects.
267
304
 
268
305
  Parameters
269
306
  ----------
270
307
  entity_type : str
271
- Entity type.
308
+ The type of entities to list (typically 'project').
272
309
  **kwargs : dict
273
- Parameters to pass to API call.
310
+ Additional parameters including 'local' flag and
311
+ API call parameters for filtering or pagination.
274
312
 
275
313
  Returns
276
314
  -------
277
315
  list[Project]
278
- List of objects.
316
+ List of project entity objects.
279
317
  """
280
318
  client = get_client(kwargs.pop("local", False))
281
319
  objs = self._list_base_entities(client, entity_type, **kwargs)
@@ -295,25 +333,28 @@ class BaseEntityOperationsProcessor:
295
333
  **kwargs,
296
334
  ) -> dict:
297
335
  """
298
- Update object method.
336
+ Update a base entity in the backend.
337
+
338
+ Builds the appropriate API endpoint and sends an update request
339
+ to modify an existing entity in the backend.
299
340
 
300
341
  Parameters
301
342
  ----------
302
343
  client : Client
303
- Client instance.
344
+ The client instance to use for the API call.
304
345
  entity_type : str
305
- Entity type.
346
+ The type of entity to update (e.g., 'project').
306
347
  entity_name : str
307
- Entity name.
348
+ The name identifier of the entity to update.
308
349
  entity_dict : dict
309
- Object instance.
350
+ The updated entity data dictionary.
310
351
  **kwargs : dict
311
- Parameters to pass to the API call.
352
+ Additional parameters to pass to the API call.
312
353
 
313
354
  Returns
314
355
  -------
315
356
  dict
316
- Object instance.
357
+ The updated entity data returned from the backend.
317
358
  """
318
359
  api = client.build_api(
319
360
  ApiCategories.BASE.value,
@@ -331,23 +372,27 @@ class BaseEntityOperationsProcessor:
331
372
  **kwargs,
332
373
  ) -> Project:
333
374
  """
334
- Update object method.
375
+ Update a project entity in the backend.
376
+
377
+ Updates an existing project with new data and returns the
378
+ updated Project entity object.
335
379
 
336
380
  Parameters
337
381
  ----------
338
382
  entity_type : str
339
- Entity type.
383
+ The type of entity to update (typically 'project').
340
384
  entity_name : str
341
- Entity name.
385
+ The name identifier of the project to update.
342
386
  entity_dict : dict
343
- Object instance.
387
+ The updated project data dictionary.
344
388
  **kwargs : dict
345
- Parameters to pass to entity builder.
389
+ Additional parameters including 'local' flag and
390
+ API call parameters.
346
391
 
347
392
  Returns
348
393
  -------
349
394
  Project
350
- Object instance.
395
+ The updated project entity object.
351
396
  """
352
397
  client = get_client(kwargs.pop("local", False))
353
398
  obj = self._update_base_entity(client, entity_type, entity_name, entity_dict, **kwargs)
@@ -362,23 +407,27 @@ class BaseEntityOperationsProcessor:
362
407
  **kwargs,
363
408
  ) -> dict:
364
409
  """
365
- Delete object method.
410
+ Delete a base entity from the backend.
411
+
412
+ Builds the appropriate API endpoint and parameters, then sends
413
+ a delete request to remove the entity from the backend.
366
414
 
367
415
  Parameters
368
416
  ----------
369
417
  client : Client
370
- Client instance.
418
+ The client instance to use for the API call.
371
419
  entity_type : str
372
- Entity type.
420
+ The type of entity to delete (e.g., 'project').
373
421
  entity_name : str
374
- Entity name.
422
+ The name identifier of the entity to delete.
375
423
  **kwargs : dict
376
- Parameters to pass to the API call.
424
+ Additional parameters to pass to the API call, such as
425
+ cascade deletion options.
377
426
 
378
427
  Returns
379
428
  -------
380
429
  dict
381
- Response from backend.
430
+ Response data from the backend delete operation.
382
431
  """
383
432
  kwargs = client.build_parameters(
384
433
  ApiCategories.BASE.value,
@@ -400,21 +449,25 @@ class BaseEntityOperationsProcessor:
400
449
  **kwargs,
401
450
  ) -> dict:
402
451
  """
403
- Delete object method.
452
+ Delete a project entity from the backend.
453
+
454
+ Deletes a project from the backend and optionally cleans up
455
+ the associated context. Handles both local and remote backends.
404
456
 
405
457
  Parameters
406
458
  ----------
407
459
  entity_type : str
408
- Entity type.
460
+ The type of entity to delete (typically 'project').
409
461
  entity_name : str
410
- Entity name.
462
+ The name identifier of the project to delete.
411
463
  **kwargs : dict
412
- Parameters to pass to entity builder.
464
+ Additional parameters including 'local' flag, 'clean_context'
465
+ flag (default True), and API call parameters.
413
466
 
414
467
  Returns
415
468
  -------
416
469
  dict
417
- Response from backend.
470
+ Response data from the backend delete operation.
418
471
  """
419
472
  if kwargs.pop("clean_context", True):
420
473
  delete_context(entity_name)
@@ -436,19 +489,22 @@ class BaseEntityOperationsProcessor:
436
489
  entity_id: str,
437
490
  ) -> str:
438
491
  """
439
- Build object key.
492
+ Build a storage key for a base entity.
493
+
494
+ Creates a standardized key string that can be used to identify
495
+ and store the entity in various contexts.
440
496
 
441
497
  Parameters
442
498
  ----------
443
499
  client : Client
444
- Client instance.
500
+ The client instance to use for key building.
445
501
  entity_id : str
446
- Entity ID.
502
+ The unique identifier of the entity.
447
503
 
448
504
  Returns
449
505
  -------
450
506
  str
451
- Object key.
507
+ The constructed entity key string.
452
508
  """
453
509
  return client.build_key(ApiCategories.BASE.value, entity_id)
454
510
 
@@ -458,19 +514,22 @@ class BaseEntityOperationsProcessor:
458
514
  **kwargs,
459
515
  ) -> str:
460
516
  """
461
- Build object key.
517
+ Build a storage key for a project entity.
518
+
519
+ Creates a standardized key string for project identification
520
+ and storage, handling both local and remote client contexts.
462
521
 
463
522
  Parameters
464
523
  ----------
465
524
  entity_id : str
466
- Entity ID.
525
+ The unique identifier of the project entity.
467
526
  **kwargs : dict
468
- Parameters to pass to entity builder.
527
+ Additional parameters including 'local' flag.
469
528
 
470
529
  Returns
471
530
  -------
472
531
  str
473
- Object key.
532
+ The constructed project entity key string.
474
533
  """
475
534
  client = get_client(kwargs.pop("local", False))
476
535
  return self._build_base_entity_key(client, entity_id)
@@ -482,20 +541,32 @@ class BaseEntityOperationsProcessor:
482
541
  **kwargs,
483
542
  ) -> None:
484
543
  """
485
- Share object method.
544
+ Share or unshare a project entity with a user.
545
+
546
+ Manages project access permissions by sharing the project with
547
+ a specified user or removing user access. Handles both sharing
548
+ and unsharing operations based on the 'unshare' parameter.
486
549
 
487
550
  Parameters
488
551
  ----------
489
552
  entity_type : str
490
- Entity type.
553
+ The type of entity to share (typically 'project').
491
554
  entity_name : str
492
- Entity name.
555
+ The name identifier of the project to share.
493
556
  **kwargs : dict
494
- Parameters to pass to entity builder.
557
+ Additional parameters including:
558
+ - 'user': username to share with/unshare from
559
+ - 'unshare': boolean flag for unsharing (default False)
560
+ - 'local': boolean flag for local backend
495
561
 
496
562
  Returns
497
563
  -------
498
564
  None
565
+
566
+ Raises
567
+ ------
568
+ ValueError
569
+ If trying to unshare from a user who doesn't have access.
499
570
  """
500
571
  client = get_client(kwargs.pop("local", False))
501
572
  api = client.build_api(