synapse-sdk 2025.9.1__py3-none-any.whl → 2025.9.4__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 synapse-sdk might be problematic. Click here for more details.
- synapse_sdk/devtools/docs/docs/api/clients/annotation-mixin.md +378 -0
- synapse_sdk/devtools/docs/docs/api/clients/backend.md +368 -1
- synapse_sdk/devtools/docs/docs/api/clients/core-mixin.md +477 -0
- synapse_sdk/devtools/docs/docs/api/clients/data-collection-mixin.md +422 -0
- synapse_sdk/devtools/docs/docs/api/clients/hitl-mixin.md +554 -0
- synapse_sdk/devtools/docs/docs/api/clients/index.md +391 -0
- synapse_sdk/devtools/docs/docs/api/clients/integration-mixin.md +571 -0
- synapse_sdk/devtools/docs/docs/api/clients/ml-mixin.md +578 -0
- synapse_sdk/devtools/docs/docs/plugins/developing-upload-template.md +1463 -0
- synapse_sdk/devtools/docs/docs/plugins/export-plugins.md +161 -34
- synapse_sdk/devtools/docs/docs/plugins/upload-plugins.md +1497 -213
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/annotation-mixin.md +289 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/backend.md +378 -11
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/core-mixin.md +417 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/data-collection-mixin.md +356 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/hitl-mixin.md +192 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/index.md +391 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/integration-mixin.md +479 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/ml-mixin.md +284 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/developing-upload-template.md +1463 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/export-plugins.md +161 -34
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/upload-plugins.md +1752 -572
- synapse_sdk/devtools/docs/sidebars.ts +7 -0
- synapse_sdk/plugins/README.md +1 -2
- synapse_sdk/plugins/categories/base.py +7 -0
- synapse_sdk/plugins/categories/export/actions/__init__.py +3 -0
- synapse_sdk/plugins/categories/export/actions/export/__init__.py +28 -0
- synapse_sdk/plugins/categories/export/actions/export/action.py +160 -0
- synapse_sdk/plugins/categories/export/actions/export/enums.py +113 -0
- synapse_sdk/plugins/categories/export/actions/export/exceptions.py +53 -0
- synapse_sdk/plugins/categories/export/actions/export/models.py +74 -0
- synapse_sdk/plugins/categories/export/actions/export/run.py +195 -0
- synapse_sdk/plugins/categories/export/actions/export/utils.py +187 -0
- synapse_sdk/plugins/categories/export/templates/plugin/__init__.py +1 -1
- synapse_sdk/plugins/categories/upload/actions/upload/__init__.py +1 -2
- synapse_sdk/plugins/categories/upload/actions/upload/action.py +154 -531
- synapse_sdk/plugins/categories/upload/actions/upload/context.py +185 -0
- synapse_sdk/plugins/categories/upload/actions/upload/factory.py +143 -0
- synapse_sdk/plugins/categories/upload/actions/upload/models.py +66 -29
- synapse_sdk/plugins/categories/upload/actions/upload/orchestrator.py +182 -0
- synapse_sdk/plugins/categories/upload/actions/upload/registry.py +113 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/base.py +106 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/cleanup.py +62 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/collection.py +62 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/generate.py +80 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/initialize.py +66 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/metadata.py +101 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/organize.py +89 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/upload.py +96 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/validate.py +61 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/base.py +86 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/batch.py +39 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/single.py +34 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/flat.py +233 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/recursive.py +253 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/excel.py +174 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/none.py +16 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/async_upload.py +109 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/sync.py +43 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/default.py +45 -0
- synapse_sdk/plugins/categories/upload/actions/upload/utils.py +194 -83
- synapse_sdk/plugins/categories/upload/templates/config.yaml +4 -0
- synapse_sdk/plugins/categories/upload/templates/plugin/__init__.py +269 -0
- synapse_sdk/plugins/categories/upload/templates/plugin/upload.py +71 -27
- synapse_sdk/plugins/models.py +7 -0
- synapse_sdk/shared/__init__.py +21 -0
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.4.dist-info}/METADATA +2 -1
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.4.dist-info}/RECORD +79 -28
- synapse_sdk/plugins/categories/export/actions/export.py +0 -385
- synapse_sdk/plugins/categories/export/enums.py +0 -7
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.4.dist-info}/WHEEL +0 -0
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.4.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.4.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.4.dist-info}/top_level.txt +0 -0
|
@@ -47,43 +47,43 @@ classDiagram
|
|
|
47
47
|
+export_items: Generator
|
|
48
48
|
+path_root: Path
|
|
49
49
|
+params: dict
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
%% Main workflow methods
|
|
52
52
|
+export(export_items, results, **kwargs) dict
|
|
53
53
|
+process_data_conversion(export_item) object
|
|
54
54
|
+process_file_saving(...) bool
|
|
55
55
|
+setup_output_directories(path, flag) dict
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
%% Abstract methods (to be implemented)
|
|
58
58
|
+convert_data(data)* object
|
|
59
|
-
+before_convert(data)* object
|
|
59
|
+
+before_convert(data)* object
|
|
60
60
|
+after_convert(data)* object
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
%% File operations
|
|
63
63
|
+save_original_file(result, path, errors) ExportStatus
|
|
64
64
|
+save_as_json(result, path, errors) ExportStatus
|
|
65
65
|
+get_original_file_name(files) str
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
%% Helper methods
|
|
68
68
|
-_create_unique_export_path(name) Path
|
|
69
69
|
-_save_error_list(path, json_errors, file_errors)
|
|
70
70
|
-_process_original_file_saving(...) bool
|
|
71
71
|
-_process_json_file_saving(...) bool
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
class Exporter {
|
|
75
75
|
%% Inherited from BaseExporter
|
|
76
76
|
+export(export_items, results, **kwargs) dict
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
%% Implemented abstract methods
|
|
79
79
|
+convert_data(data) object
|
|
80
80
|
+before_convert(data) object
|
|
81
81
|
+after_convert(data) object
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
%% Inheritance relationship
|
|
85
85
|
BaseExporter <|-- Exporter
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
%% Apply styles
|
|
88
88
|
class BaseExporter baseClass
|
|
89
89
|
class Exporter childClass
|
|
@@ -99,44 +99,44 @@ flowchart TD
|
|
|
99
99
|
A[export method called] --> B[Initialize paths and metrics]
|
|
100
100
|
B --> C[Setup output directories]
|
|
101
101
|
C --> D[Loop through export_items]
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
%% Data processing pipeline
|
|
104
104
|
D --> E[process_data_conversion]
|
|
105
105
|
E --> F[before_convert]
|
|
106
106
|
F --> G[convert_data]
|
|
107
107
|
G --> H[after_convert]
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
%% File saving pipeline
|
|
110
110
|
H --> I[process_file_saving]
|
|
111
111
|
I --> J{save_original_file?}
|
|
112
112
|
J -->|Yes| K[_process_original_file_saving]
|
|
113
113
|
J -->|No| L[_process_json_file_saving]
|
|
114
114
|
K --> L
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
%% Continue or finish
|
|
117
117
|
L --> M{More items?}
|
|
118
118
|
M -->|Yes| D
|
|
119
119
|
M -->|No| N[Save error lists]
|
|
120
120
|
N --> O[Return export path]
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
%% Error handling
|
|
123
123
|
K --> P{Original file failed?}
|
|
124
124
|
P -->|Yes| Q[Skip to next item]
|
|
125
125
|
P -->|No| L
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
L --> R{JSON file failed?}
|
|
128
128
|
R -->|Yes| Q
|
|
129
129
|
R -->|No| S[Update metrics]
|
|
130
130
|
S --> M
|
|
131
131
|
Q --> M
|
|
132
|
-
|
|
132
|
+
|
|
133
133
|
%% Styling for light/dark compatibility
|
|
134
134
|
classDef startEnd fill:#e1f5fe,stroke:#01579b,color:#000
|
|
135
135
|
classDef process fill:#f3e5f5,stroke:#4a148c,color:#000
|
|
136
136
|
classDef decision fill:#fff3e0,stroke:#e65100,color:#000
|
|
137
137
|
classDef data fill:#e8f5e8,stroke:#2e7d32,color:#000
|
|
138
138
|
classDef error fill:#ffebee,stroke:#c62828,color:#000
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
class A,O startEnd
|
|
141
141
|
class B,C,E,F,G,H,I,K,L,N,S process
|
|
142
142
|
class J,M,P,R decision
|
|
@@ -147,20 +147,23 @@ flowchart TD
|
|
|
147
147
|
### Key Relationships and Responsibilities
|
|
148
148
|
|
|
149
149
|
**BaseExporter (Abstract Base Class)**
|
|
150
|
+
|
|
150
151
|
- **Core Functionality**: Provides complete export workflow infrastructure
|
|
151
152
|
- **Template Methods**: `export()` method orchestrates the entire process
|
|
152
153
|
- **Hook Methods**: `convert_data()`, `before_convert()`, `after_convert()` for customization
|
|
153
154
|
- **Utilities**: File operations, directory setup, error handling, progress tracking
|
|
154
155
|
|
|
155
|
-
**Exporter (Concrete Implementation)**
|
|
156
|
+
**Exporter (Concrete Implementation)**
|
|
157
|
+
|
|
156
158
|
- **Inheritance**: Extends `BaseExporter`
|
|
157
159
|
- **Minimal Implementation**: Provides basic implementations of abstract methods
|
|
158
160
|
- **Pass-through Behavior**: Most methods delegate to parent class
|
|
159
161
|
- **Customization Points**: Override conversion methods for specific logic
|
|
160
162
|
|
|
161
163
|
### Method Categories
|
|
164
|
+
|
|
162
165
|
- **🔵 Core Workflow**: Main export orchestration methods
|
|
163
|
-
- **🟢 Template/Hook**: Methods designed to be overridden by subclasses
|
|
166
|
+
- **🟢 Template/Hook**: Methods designed to be overridden by subclasses
|
|
164
167
|
- **🟡 File Operations**: Concrete file saving and handling methods
|
|
165
168
|
- **🔸 Helper/Utility**: Private methods for internal operations
|
|
166
169
|
|
|
@@ -240,12 +243,12 @@ The `additional_file_saving()` method is called after all export items have been
|
|
|
240
243
|
```python
|
|
241
244
|
def additional_file_saving(self, unique_export_path):
|
|
242
245
|
"""Save additional files after processing all export items.
|
|
243
|
-
|
|
246
|
+
|
|
244
247
|
This method is called after the main export loop completes and is intended
|
|
245
248
|
for saving files that need to be created based on the collective data from
|
|
246
249
|
all processed export items (e.g., metadata files, configuration files,
|
|
247
250
|
summary files, etc.).
|
|
248
|
-
|
|
251
|
+
|
|
249
252
|
Args:
|
|
250
253
|
unique_export_path (str): The unique export directory path where
|
|
251
254
|
additional files should be saved.
|
|
@@ -265,7 +268,7 @@ class YOLOExporter(BaseExporter):
|
|
|
265
268
|
'total_annotations': 0,
|
|
266
269
|
'class_distribution': {}
|
|
267
270
|
}
|
|
268
|
-
|
|
271
|
+
|
|
269
272
|
def convert_data(self, data):
|
|
270
273
|
# Track classes and stats during conversion
|
|
271
274
|
for annotation in data.get('annotations', []):
|
|
@@ -273,24 +276,24 @@ class YOLOExporter(BaseExporter):
|
|
|
273
276
|
self.class_names.add(class_name)
|
|
274
277
|
self.dataset_stats['class_distribution'][class_name] = \
|
|
275
278
|
self.dataset_stats['class_distribution'].get(class_name, 0) + 1
|
|
276
|
-
|
|
279
|
+
|
|
277
280
|
self.dataset_stats['total_images'] += 1
|
|
278
281
|
self.dataset_stats['total_annotations'] += len(data.get('annotations', []))
|
|
279
|
-
|
|
282
|
+
|
|
280
283
|
return data # ... rest of conversion logic
|
|
281
|
-
|
|
284
|
+
|
|
282
285
|
def additional_file_saving(self, unique_export_path):
|
|
283
286
|
"""Save YOLO configuration and metadata files."""
|
|
284
287
|
data_dir = Path(unique_export_path) / 'data'
|
|
285
288
|
data_dir.mkdir(exist_ok=True)
|
|
286
|
-
|
|
289
|
+
|
|
287
290
|
# 1. Save classes.txt file
|
|
288
291
|
classes_file = data_dir / 'classes.txt'
|
|
289
292
|
with classes_file.open('w') as f:
|
|
290
293
|
for class_name in sorted(self.class_names):
|
|
291
294
|
f.write(f"{class_name}\n")
|
|
292
295
|
self.run.log_message(f"Saved classes file: {classes_file}")
|
|
293
|
-
|
|
296
|
+
|
|
294
297
|
# 2. Save dataset.yaml file
|
|
295
298
|
dataset_config = {
|
|
296
299
|
'path': str(unique_export_path),
|
|
@@ -298,12 +301,12 @@ class YOLOExporter(BaseExporter):
|
|
|
298
301
|
'val': 'images',
|
|
299
302
|
'names': {i: name for i, name in enumerate(sorted(self.class_names))}
|
|
300
303
|
}
|
|
301
|
-
|
|
304
|
+
|
|
302
305
|
dataset_file = data_dir / 'dataset.yaml'
|
|
303
306
|
with dataset_file.open('w') as f:
|
|
304
307
|
yaml.dump(dataset_config, f, default_flow_style=False)
|
|
305
308
|
self.run.log_message(f"Saved dataset config: {dataset_file}")
|
|
306
|
-
|
|
309
|
+
|
|
307
310
|
# 3. Save export statistics
|
|
308
311
|
stats_file = data_dir / 'export_stats.json'
|
|
309
312
|
with stats_file.open('w') as f:
|
|
@@ -314,6 +317,7 @@ class YOLOExporter(BaseExporter):
|
|
|
314
317
|
### Common Use Cases
|
|
315
318
|
|
|
316
319
|
#### 1. Dataset Configuration Files
|
|
320
|
+
|
|
317
321
|
```python
|
|
318
322
|
def additional_file_saving(self, unique_export_path):
|
|
319
323
|
# Create dataset configuration for training frameworks
|
|
@@ -323,13 +327,14 @@ def additional_file_saving(self, unique_export_path):
|
|
|
323
327
|
'total_samples': len(self.processed_items),
|
|
324
328
|
'classes': list(self.class_mapping.keys())
|
|
325
329
|
}
|
|
326
|
-
|
|
330
|
+
|
|
327
331
|
config_file = Path(unique_export_path) / 'dataset_config.json'
|
|
328
332
|
with config_file.open('w') as f:
|
|
329
333
|
json.dump(config, f, indent=2)
|
|
330
334
|
```
|
|
331
335
|
|
|
332
336
|
#### 2. Export Summary Reports
|
|
337
|
+
|
|
333
338
|
```python
|
|
334
339
|
def additional_file_saving(self, unique_export_path):
|
|
335
340
|
# Generate export summary
|
|
@@ -342,13 +347,14 @@ def additional_file_saving(self, unique_export_path):
|
|
|
342
347
|
'statistics': self.get_export_statistics(),
|
|
343
348
|
'errors': self.get_error_summary()
|
|
344
349
|
}
|
|
345
|
-
|
|
350
|
+
|
|
346
351
|
summary_file = Path(unique_export_path) / 'export_summary.json'
|
|
347
352
|
with summary_file.open('w') as f:
|
|
348
353
|
json.dump(summary, f, indent=2)
|
|
349
354
|
```
|
|
350
355
|
|
|
351
356
|
#### 3. Index and Manifest Files
|
|
357
|
+
|
|
352
358
|
```python
|
|
353
359
|
def additional_file_saving(self, unique_export_path):
|
|
354
360
|
# Create file index for processed items
|
|
@@ -359,7 +365,7 @@ def additional_file_saving(self, unique_export_path):
|
|
|
359
365
|
'json_file': f"{item['stem']}.json",
|
|
360
366
|
'processed_at': item['timestamp']
|
|
361
367
|
})
|
|
362
|
-
|
|
368
|
+
|
|
363
369
|
index_file = Path(unique_export_path) / 'file_index.json'
|
|
364
370
|
with index_file.open('w') as f:
|
|
365
371
|
json.dump(file_index, f, indent=2)
|
|
@@ -540,6 +546,127 @@ my_plugin/
|
|
|
540
546
|
└── manifest.yaml # Plugin metadata
|
|
541
547
|
```
|
|
542
548
|
|
|
549
|
+
## Export Action Architecture
|
|
550
|
+
|
|
551
|
+
The export system has been refactored into a modular architecture with specialized components for different aspects of data export processing:
|
|
552
|
+
|
|
553
|
+
```mermaid
|
|
554
|
+
classDiagram
|
|
555
|
+
%% Light/Dark mode compatible colors with semi-transparency
|
|
556
|
+
classDef baseClass fill:#e1f5fe80,stroke:#0288d1,stroke-width:2px
|
|
557
|
+
classDef childClass fill:#c8e6c980,stroke:#388e3c,stroke-width:2px
|
|
558
|
+
classDef modelClass fill:#fff9c480,stroke:#f57c00,stroke-width:2px
|
|
559
|
+
classDef utilClass fill:#f5f5f580,stroke:#616161,stroke-width:2px
|
|
560
|
+
classDef enumClass fill:#ffccbc80,stroke:#d32f2f,stroke-width:2px
|
|
561
|
+
|
|
562
|
+
class ExportAction {
|
|
563
|
+
+name: str = "export"
|
|
564
|
+
+category: PluginCategory.EXPORT
|
|
565
|
+
+method: RunMethod.JOB
|
|
566
|
+
+run_class: ExportRun
|
|
567
|
+
+params_model: ExportParams
|
|
568
|
+
+progress_categories: dict
|
|
569
|
+
+metrics_categories: dict
|
|
570
|
+
|
|
571
|
+
+start() dict
|
|
572
|
+
+get_exporter(...) object
|
|
573
|
+
+_get_export_items(target, filter) Generator
|
|
574
|
+
+_create_target_handler(target) object
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
class ExportRun {
|
|
578
|
+
+log_message_with_code(code, args, level) None
|
|
579
|
+
+log_export_event(code, args, level) None
|
|
580
|
+
+export_log_json_file(id, file_info, status) None
|
|
581
|
+
+export_log_original_file(id, file_info, status) None
|
|
582
|
+
+ExportEventLog: BaseModel
|
|
583
|
+
+DataFileLog: BaseModel
|
|
584
|
+
+MetricsRecord: BaseModel
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
class ExportParams {
|
|
588
|
+
+name: str
|
|
589
|
+
+storage: int
|
|
590
|
+
+target: Literal["assignment", "ground_truth", "task"]
|
|
591
|
+
+filter: dict
|
|
592
|
+
+path: str
|
|
593
|
+
+save_original_file: bool = True
|
|
594
|
+
+extra_params: dict = {}
|
|
595
|
+
|
|
596
|
+
+check_storage_exists(value) str
|
|
597
|
+
+validate_target_filter(cls, values) dict
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
class LogCode {
|
|
601
|
+
+EXPORT_STARTED: str
|
|
602
|
+
+ITEMS_DISCOVERED: str
|
|
603
|
+
+CONVERSION_STARTED: str
|
|
604
|
+
+CONVERSION_COMPLETED: str
|
|
605
|
+
+FILE_SAVED: str
|
|
606
|
+
+EXPORT_COMPLETED: str
|
|
607
|
+
+EXPORT_FAILED: str
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
class ExportStatus {
|
|
611
|
+
+SUCCESS: str = "success"
|
|
612
|
+
+FAILED: str = "failed"
|
|
613
|
+
+SKIPPED: str = "skipped"
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
class ExportError {
|
|
617
|
+
+message: str
|
|
618
|
+
+code: str
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
class ExportValidationError {
|
|
622
|
+
+message: str
|
|
623
|
+
+field: str
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
class ExportTargetError {
|
|
627
|
+
+message: str
|
|
628
|
+
+target: str
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
%% Relationships
|
|
632
|
+
ExportAction --> ExportRun : uses
|
|
633
|
+
ExportAction --> ExportParams : validates with
|
|
634
|
+
ExportRun --> LogCode : logs with
|
|
635
|
+
ExportRun --> ExportStatus : tracks status
|
|
636
|
+
ExportAction --> ExportError : may raise
|
|
637
|
+
ExportAction --> ExportValidationError : may raise
|
|
638
|
+
ExportAction --> ExportTargetError : may raise
|
|
639
|
+
|
|
640
|
+
%% Apply styles
|
|
641
|
+
class ExportAction baseClass
|
|
642
|
+
class ExportRun childClass
|
|
643
|
+
class ExportParams modelClass
|
|
644
|
+
class LogCode,ExportStatus enumClass
|
|
645
|
+
class ExportError,ExportValidationError,ExportTargetError utilClass
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### Modular Structure
|
|
649
|
+
|
|
650
|
+
The export action follows a clean modular organization:
|
|
651
|
+
|
|
652
|
+
```
|
|
653
|
+
synapse_sdk/plugins/categories/export/actions/export/
|
|
654
|
+
├── __init__.py # Clean module interfaces
|
|
655
|
+
├── action.py # ExportAction class
|
|
656
|
+
├── enums.py # ExportStatus, LogCode + LOG_MESSAGES
|
|
657
|
+
├── exceptions.py # Export-specific exceptions
|
|
658
|
+
├── models.py # ExportParams model
|
|
659
|
+
├── run.py # ExportRun class
|
|
660
|
+
└── utils.py # Target handlers and utilities
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
**Key Benefits:**
|
|
664
|
+
|
|
665
|
+
- **Enhanced Maintainability**: Smaller, focused files are easier to understand and modify
|
|
666
|
+
- **Code Consistency**: Export action now follows the same pattern as upload action
|
|
667
|
+
- **Better Organization**: Related functionality is grouped logically
|
|
668
|
+
- **Improved Readability**: Clear separation of concerns across modules
|
|
669
|
+
|
|
543
670
|
## Creating Export Plugins
|
|
544
671
|
|
|
545
672
|
Export plugins now use the BaseExporter class-based approach for better organization and reusability. Here's how to create a custom export plugin:
|
|
@@ -557,7 +684,7 @@ synapse plugin create
|
|
|
557
684
|
The `ExportParams` model defines the required parameters:
|
|
558
685
|
|
|
559
686
|
```python
|
|
560
|
-
from synapse_sdk.plugins.categories.export.actions.export import ExportParams
|
|
687
|
+
from synapse_sdk.plugins.categories.export.actions.export.models import ExportParams
|
|
561
688
|
from pydantic import BaseModel
|
|
562
689
|
from typing import Literal
|
|
563
690
|
|
|
@@ -664,7 +791,7 @@ Customize file saving and organization by overriding BaseExporter methods:
|
|
|
664
791
|
```python
|
|
665
792
|
import json
|
|
666
793
|
from pathlib import Path
|
|
667
|
-
from synapse_sdk.plugins.categories.export.enums import ExportStatus
|
|
794
|
+
from synapse_sdk.plugins.categories.export.actions.export.enums import ExportStatus
|
|
668
795
|
|
|
669
796
|
class Exporter(BaseExporter):
|
|
670
797
|
"""Custom export plugin with multiple format support."""
|
|
@@ -923,4 +1050,4 @@ A: Yes, you can override the `process_file_saving()` method to save in multiple
|
|
|
923
1050
|
A: Consider using streaming processing in `convert_data()` rather than loading all data at once.
|
|
924
1051
|
|
|
925
1052
|
**Q: What should I do if progress is not displaying correctly?**
|
|
926
|
-
A: Make sure you're calling `self.run.set_progress()` at appropriate intervals and using integer values between 0-100.
|
|
1053
|
+
A: Make sure you're calling `self.run.set_progress()` at appropriate intervals and using integer values between 0-100.
|