synapse-sdk 2025.9.5__py3-none-any.whl → 2025.10.6__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.

Files changed (78) hide show
  1. synapse_sdk/clients/base.py +129 -9
  2. synapse_sdk/devtools/docs/docs/api/clients/base.md +230 -8
  3. synapse_sdk/devtools/docs/docs/api/plugins/models.md +58 -3
  4. synapse_sdk/devtools/docs/docs/plugins/categories/neural-net-plugins/train-action-overview.md +663 -0
  5. synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
  6. synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
  7. synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
  8. synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
  9. synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-action.md +934 -0
  10. synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-overview.md +585 -0
  11. synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-template.md +715 -0
  12. synapse_sdk/devtools/docs/docs/plugins/export-plugins.md +39 -0
  13. synapse_sdk/devtools/docs/docs/plugins/plugins.md +12 -5
  14. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/base.md +230 -8
  15. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/plugins/models.md +114 -0
  16. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/neural-net-plugins/train-action-overview.md +621 -0
  17. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
  18. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
  19. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
  20. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
  21. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-action.md +934 -0
  22. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-overview.md +585 -0
  23. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-template.md +715 -0
  24. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/export-plugins.md +39 -0
  25. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current.json +16 -4
  26. synapse_sdk/devtools/docs/sidebars.ts +45 -1
  27. synapse_sdk/plugins/README.md +487 -80
  28. synapse_sdk/plugins/categories/base.py +1 -0
  29. synapse_sdk/plugins/categories/export/actions/export/action.py +8 -3
  30. synapse_sdk/plugins/categories/export/actions/export/utils.py +108 -8
  31. synapse_sdk/plugins/categories/export/templates/config.yaml +18 -0
  32. synapse_sdk/plugins/categories/export/templates/plugin/export.py +97 -0
  33. synapse_sdk/plugins/categories/neural_net/actions/train.py +592 -22
  34. synapse_sdk/plugins/categories/neural_net/actions/tune.py +150 -3
  35. synapse_sdk/plugins/categories/pre_annotation/actions/__init__.py +4 -0
  36. synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/__init__.py +3 -0
  37. synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/action.py +10 -0
  38. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/__init__.py +28 -0
  39. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/action.py +145 -0
  40. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/enums.py +269 -0
  41. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/exceptions.py +14 -0
  42. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/factory.py +76 -0
  43. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/models.py +97 -0
  44. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/orchestrator.py +250 -0
  45. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/run.py +64 -0
  46. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/__init__.py +17 -0
  47. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/annotation.py +284 -0
  48. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/base.py +170 -0
  49. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/extraction.py +83 -0
  50. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/metrics.py +87 -0
  51. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/preprocessor.py +127 -0
  52. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/validation.py +143 -0
  53. synapse_sdk/plugins/categories/upload/actions/upload/__init__.py +2 -1
  54. synapse_sdk/plugins/categories/upload/actions/upload/action.py +8 -1
  55. synapse_sdk/plugins/categories/upload/actions/upload/context.py +0 -1
  56. synapse_sdk/plugins/categories/upload/actions/upload/models.py +134 -94
  57. synapse_sdk/plugins/categories/upload/actions/upload/steps/cleanup.py +2 -2
  58. synapse_sdk/plugins/categories/upload/actions/upload/steps/generate.py +6 -2
  59. synapse_sdk/plugins/categories/upload/actions/upload/steps/initialize.py +24 -9
  60. synapse_sdk/plugins/categories/upload/actions/upload/steps/metadata.py +130 -18
  61. synapse_sdk/plugins/categories/upload/actions/upload/steps/organize.py +147 -37
  62. synapse_sdk/plugins/categories/upload/actions/upload/steps/upload.py +10 -5
  63. synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/flat.py +31 -6
  64. synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/recursive.py +65 -37
  65. synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/default.py +17 -2
  66. synapse_sdk/plugins/categories/upload/templates/README.md +394 -0
  67. synapse_sdk/plugins/models.py +62 -0
  68. synapse_sdk/utils/file/download.py +261 -0
  69. {synapse_sdk-2025.9.5.dist-info → synapse_sdk-2025.10.6.dist-info}/METADATA +15 -2
  70. {synapse_sdk-2025.9.5.dist-info → synapse_sdk-2025.10.6.dist-info}/RECORD +74 -43
  71. synapse_sdk/devtools/docs/docs/plugins/developing-upload-template.md +0 -1463
  72. synapse_sdk/devtools/docs/docs/plugins/upload-plugins.md +0 -1964
  73. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/developing-upload-template.md +0 -1463
  74. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/upload-plugins.md +0 -2077
  75. {synapse_sdk-2025.9.5.dist-info → synapse_sdk-2025.10.6.dist-info}/WHEEL +0 -0
  76. {synapse_sdk-2025.9.5.dist-info → synapse_sdk-2025.10.6.dist-info}/entry_points.txt +0 -0
  77. {synapse_sdk-2025.9.5.dist-info → synapse_sdk-2025.10.6.dist-info}/licenses/LICENSE +0 -0
  78. {synapse_sdk-2025.9.5.dist-info → synapse_sdk-2025.10.6.dist-info}/top_level.txt +0 -0
@@ -164,6 +164,7 @@ class Action:
164
164
  'params': self.params,
165
165
  'envs': self.envs,
166
166
  'debug': self.debug,
167
+ 'action_name': self.name,
167
168
  }
168
169
  return self.run_class(self.job_id, context)
169
170
 
@@ -95,11 +95,11 @@ class ExportAction(Action):
95
95
  PydanticCustomError: If data retrieval fails
96
96
  """
97
97
  try:
98
- result_list = handler.get_results(self.client, filters)
98
+ result_list = handler.get_results(self.client, filters, run=self.run)
99
99
  results = result_list[0]
100
100
  count = result_list[1]
101
101
  except ClientError:
102
- raise PydanticCustomError('client_error', _('Unable to get Ground Truth dataset.'))
102
+ raise PydanticCustomError('client_error', _('Unable to get dataset.'))
103
103
  return results, count
104
104
 
105
105
  def start(self) -> Dict[str, Any]:
@@ -116,7 +116,12 @@ class ExportAction(Action):
116
116
  """
117
117
  self.run.log_message_with_code(LogCode.EXPORT_STARTED)
118
118
 
119
- filters = {'expand': 'data', **self.params['filter']}
119
+ # Get expand setting from config, default to True (expand data)
120
+ filters = {**self.params['filter']}
121
+ data_expand = self.config.get('data_expand', True)
122
+ if data_expand:
123
+ filters['expand'] = 'data'
124
+
120
125
  target = self.params['target']
121
126
  handler = TargetHandlerFactory.get_handler(target)
122
127
 
@@ -1,10 +1,12 @@
1
1
  from abc import ABC, abstractmethod
2
- from typing import Any
2
+ from typing import Any, Optional
3
+ import time
3
4
 
4
5
  from pydantic_core import PydanticCustomError
5
6
 
6
7
  from synapse_sdk.clients.exceptions import ClientError
7
8
  from synapse_sdk.i18n import gettext as _
9
+ from synapse_sdk.shared.enums import Context
8
10
 
9
11
 
10
12
  class ExportTargetHandler(ABC):
@@ -15,6 +17,103 @@ class ExportTargetHandler(ABC):
15
17
  of methods to validate filters, retrieve results, and process collections of results.
16
18
  """
17
19
 
20
+ # TODO: This is a temporary workaround and needs improvement in the future
21
+ def _get_results_chunked(self, list_method, filters, chunk_size=100, max_retries=3, retry_delay=1, run=None):
22
+ """
23
+ Retrieve results in chunks to avoid memory and response size limits.
24
+
25
+ Args:
26
+ list_method: The client method to call (e.g., client.list_assignments)
27
+ filters (dict): The filter criteria to apply
28
+ chunk_size (int): Number of items to fetch per chunk
29
+ max_retries (int): Maximum number of retries for failed requests
30
+ retry_delay (int): Delay in seconds between retries
31
+
32
+ Returns:
33
+ tuple: A tuple containing the results generator and the total count
34
+ """
35
+ filters = filters.copy()
36
+ filters['page_size'] = chunk_size
37
+
38
+ page = 1
39
+ results = []
40
+ total_count = 0
41
+
42
+ try:
43
+ while True:
44
+ filters['page'] = page
45
+
46
+ # Retry logic for handling temporary server issues
47
+ for attempt in range(max_retries + 1):
48
+ try:
49
+ response = list_method(params=filters, list_all=False)
50
+ break
51
+ except ClientError as e:
52
+ error_msg = str(e)
53
+
54
+ # Use log_dev_event for better debugging and monitoring
55
+ if run:
56
+ run.log_dev_event(
57
+ 'Chunked data retrieval error',
58
+ {
59
+ 'page': page,
60
+ 'attempt': attempt + 1,
61
+ 'error_message': error_msg,
62
+ 'chunk_size': chunk_size,
63
+ },
64
+ level=Context.WARNING,
65
+ )
66
+
67
+ # Check for JSON decode errors specifically
68
+ if 'Expecting value' in error_msg or 'JSONDecodeError' in error_msg:
69
+ if run:
70
+ run.log_dev_event(
71
+ 'JSON parsing error - skipping page',
72
+ {'page': page, 'error_type': 'JSON_DECODE_ERROR', 'error_details': error_msg},
73
+ level=Context.DANGER,
74
+ )
75
+ # Skip this page and continue with next
76
+ page += 1
77
+ break
78
+ elif attempt < max_retries and ('503' in error_msg or 'connection' in error_msg.lower()):
79
+ retry_delay_seconds = retry_delay * (2**attempt)
80
+ if run:
81
+ run.log_dev_event(
82
+ 'Server issue - retrying with backoff',
83
+ {
84
+ 'page': page,
85
+ 'retry_attempt': attempt + 1,
86
+ 'max_retries': max_retries,
87
+ 'retry_delay_seconds': retry_delay_seconds,
88
+ 'error_type': 'SERVER_ISSUE',
89
+ },
90
+ level=Context.INFO,
91
+ )
92
+ time.sleep(retry_delay_seconds) # Exponential backoff
93
+ continue
94
+ else:
95
+ raise
96
+
97
+ if page == 1:
98
+ total_count = response['count']
99
+
100
+ current_results = response.get('results', [])
101
+ results.extend(current_results)
102
+
103
+ # Check if we've got all results or if there are no more results
104
+ if len(current_results) < chunk_size or not response.get('next'):
105
+ break
106
+
107
+ page += 1
108
+
109
+ # Small delay between pages to avoid overwhelming the server
110
+ time.sleep(0.1)
111
+
112
+ return results, total_count
113
+ except Exception:
114
+ # Re-raise the exception to be handled by the calling method
115
+ raise
116
+
18
117
  @abstractmethod
19
118
  def validate_filter(self, value: dict, client: Any):
20
119
  """
@@ -33,13 +132,14 @@ class ExportTargetHandler(ABC):
33
132
  pass
34
133
 
35
134
  @abstractmethod
36
- def get_results(self, client: Any, filters: dict):
135
+ def get_results(self, client: Any, filters: dict, run=None):
37
136
  """
38
137
  Retrieve original data from target sources.
39
138
 
40
139
  Args:
41
140
  client (Any): The client used to retrieve the results.
42
141
  filters (dict): The filter criteria to apply.
142
+ run: Optional ExportRun instance for logging.
43
143
 
44
144
  Returns:
45
145
  tuple: A tuple containing the results and the total count of results.
@@ -76,8 +176,8 @@ class AssignmentExportTargetHandler(ExportTargetHandler):
76
176
  raise PydanticCustomError('client_error', _('Unable to get Assignment.'))
77
177
  return value
78
178
 
79
- def get_results(self, client: Any, filters: dict):
80
- return client.list_assignments(params=filters, list_all=True)
179
+ def get_results(self, client: Any, filters: dict, run=None):
180
+ return self._get_results_chunked(client.list_assignments, filters, run=run)
81
181
 
82
182
  def get_export_item(self, results):
83
183
  for result in results:
@@ -104,9 +204,9 @@ class GroundTruthExportTargetHandler(ExportTargetHandler):
104
204
  raise PydanticCustomError('client_error', _('Unable to get Ground Truth dataset version.'))
105
205
  return value
106
206
 
107
- def get_results(self, client: Any, filters: dict):
207
+ def get_results(self, client: Any, filters: dict, run=None):
108
208
  filters['ground_truth_dataset_versions'] = filters.pop('ground_truth_dataset_version')
109
- return client.list_ground_truth_events(params=filters, list_all=True)
209
+ return self._get_results_chunked(client.list_ground_truth_events, filters, run=run)
110
210
 
111
211
  def get_export_item(self, results):
112
212
  for result in results:
@@ -134,9 +234,9 @@ class TaskExportTargetHandler(ExportTargetHandler):
134
234
  raise PydanticCustomError('client_error', _('Unable to get Task.'))
135
235
  return value
136
236
 
137
- def get_results(self, client: Any, filters: dict):
237
+ def get_results(self, client: Any, filters: dict, run=None):
138
238
  filters['expand'] = ['data_unit', 'assignment', 'workshop']
139
- return client.list_tasks(params=filters, list_all=True)
239
+ return self._get_results_chunked(client.list_tasks, filters, run=run)
140
240
 
141
241
  def get_export_item(self, results):
142
242
  for result in results:
@@ -1,3 +1,21 @@
1
1
  actions:
2
2
  export:
3
3
  entrypoint: plugin.export.Exporter
4
+ # Filter to only export action specific annotation types (e.g., only export image annotations project)
5
+ # Supported types: image, video, audio, text, pcd, prompt
6
+ annotation_types:
7
+ - image
8
+ - video
9
+ - audio
10
+ - text
11
+ - pcd
12
+ - prompt
13
+
14
+ # Filter to only export specific data types (e.g., only export image data)
15
+ # Supported types: image, video, audio, text, pcd
16
+ data_types:
17
+ - image
18
+ - video
19
+ - audio
20
+ - text
21
+ - pcd
@@ -61,3 +61,100 @@ class Exporter(BaseExporter):
61
61
  def after_convert(self, data):
62
62
  """Post-processes the data after conversion."""
63
63
  return data
64
+
65
+ def sample_dev_log(self):
66
+ """Sample development logging examples for plugin developers.
67
+
68
+ This method demonstrates various ways to use log_dev_event() for debugging,
69
+ monitoring, and tracking plugin execution. The event_type is automatically
70
+ generated as 'export_dev_log' for export actions and cannot be modified.
71
+
72
+ Use Cases:
73
+ 1. Process Tracking: Log when important processes start/complete
74
+ 2. Error Handling: Capture detailed error information with appropriate severity
75
+ 3. Performance Monitoring: Record timing and resource usage
76
+ 4. Data Validation: Log validation results and data quality metrics
77
+ 5. Debug Information: Track variable states and execution flow
78
+
79
+ Examples show different scenarios where development logging is beneficial:
80
+ - Basic process logging with structured data
81
+ - Error logging with exception details and danger level
82
+ - Performance tracking with timing information
83
+ - Validation logging with success/failure status
84
+ """
85
+ # Example 1: Basic Process Tracking
86
+ # Use when: Starting important processes that you want to monitor
87
+ # Benefits: Helps track execution flow and identify bottlenecks
88
+ self.run.log_dev_event(
89
+ 'Starting data conversion process',
90
+ {'data_type': 'img', 'data_size': 'unknown', 'conversion_method': 'custom_format'},
91
+ )
92
+
93
+ # Example 2: Error Handling with Detailed Information
94
+ # Use when: Catching exceptions that you want to analyze later
95
+ # Benefits: Provides structured error data for debugging and monitoring
96
+ from synapse_sdk.shared.enums import Context
97
+
98
+ try:
99
+ # Simulated operation that might fail
100
+ pass
101
+ except Exception as e:
102
+ self.run.log_dev_event(
103
+ f'Data conversion failed: {str(e)}',
104
+ {
105
+ 'error_type': type(e).__name__,
106
+ 'error_details': str(e),
107
+ 'operation': 'data_conversion',
108
+ 'recovery_attempted': False,
109
+ },
110
+ level=Context.DANGER,
111
+ )
112
+
113
+ # Example 3: Performance Monitoring
114
+ # Use when: Tracking processing time for optimization
115
+ # Benefits: Identifies performance bottlenecks and optimization opportunities
116
+ import time
117
+
118
+ start_time = time.time()
119
+ # Simulated processing work
120
+ time.sleep(0.001)
121
+ processing_time = time.time() - start_time
122
+
123
+ self.run.log_dev_event(
124
+ 'File processing completed',
125
+ {
126
+ 'processing_time_ms': round(processing_time * 1000, 2),
127
+ 'files_processed': 1,
128
+ 'performance_rating': 'excellent' if processing_time < 0.1 else 'normal',
129
+ },
130
+ )
131
+
132
+ # Example 4: Data Validation Logging
133
+ # Use when: Validating data quality or structure
134
+ # Benefits: Helps identify data issues and track validation metrics
135
+ validation_passed = True # Simulated validation result
136
+ self.run.log_dev_event(
137
+ 'Data validation completed',
138
+ {
139
+ 'validation_passed': validation_passed,
140
+ 'validation_rules': ['format_check', 'required_fields', 'data_types'],
141
+ 'data_quality_score': 95.5,
142
+ },
143
+ level=Context.SUCCESS if validation_passed else Context.WARNING,
144
+ )
145
+
146
+ # Example 5: Debug Information with Variable States
147
+ # Use when: Debugging complex logic or tracking variable changes
148
+ # Benefits: Provides insight into execution state at specific points
149
+ current_batch_size = 100
150
+ memory_usage = 45.2 # Simulated memory usage in MB
151
+
152
+ self.run.log_dev_event(
153
+ 'Processing checkpoint reached',
154
+ {
155
+ 'current_batch_size': current_batch_size,
156
+ 'memory_usage_mb': memory_usage,
157
+ 'checkpoint_location': 'after_data_preprocessing',
158
+ 'next_operation': 'file_saving',
159
+ },
160
+ )