synapse-sdk 1.0.0a23__py3-none-any.whl → 2025.12.3__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.
Files changed (228) hide show
  1. synapse_sdk/__init__.py +24 -0
  2. synapse_sdk/cli/__init__.py +310 -5
  3. synapse_sdk/cli/alias/__init__.py +22 -0
  4. synapse_sdk/cli/alias/create.py +36 -0
  5. synapse_sdk/cli/alias/dataclass.py +31 -0
  6. synapse_sdk/cli/alias/default.py +16 -0
  7. synapse_sdk/cli/alias/delete.py +15 -0
  8. synapse_sdk/cli/alias/list.py +19 -0
  9. synapse_sdk/cli/alias/read.py +15 -0
  10. synapse_sdk/cli/alias/update.py +17 -0
  11. synapse_sdk/cli/alias/utils.py +61 -0
  12. synapse_sdk/cli/code_server.py +687 -0
  13. synapse_sdk/cli/config.py +440 -0
  14. synapse_sdk/cli/devtools.py +90 -0
  15. synapse_sdk/cli/plugin/__init__.py +33 -0
  16. synapse_sdk/cli/{create_plugin.py → plugin/create.py} +2 -2
  17. synapse_sdk/{plugins/cli → cli/plugin}/publish.py +23 -15
  18. synapse_sdk/clients/agent/__init__.py +9 -3
  19. synapse_sdk/clients/agent/container.py +143 -0
  20. synapse_sdk/clients/agent/core.py +19 -0
  21. synapse_sdk/clients/agent/ray.py +298 -9
  22. synapse_sdk/clients/backend/__init__.py +30 -12
  23. synapse_sdk/clients/backend/annotation.py +13 -5
  24. synapse_sdk/clients/backend/core.py +31 -4
  25. synapse_sdk/clients/backend/data_collection.py +186 -0
  26. synapse_sdk/clients/backend/hitl.py +17 -0
  27. synapse_sdk/clients/backend/integration.py +16 -1
  28. synapse_sdk/clients/backend/ml.py +5 -1
  29. synapse_sdk/clients/backend/models.py +78 -0
  30. synapse_sdk/clients/base.py +384 -41
  31. synapse_sdk/clients/ray/serve.py +2 -0
  32. synapse_sdk/clients/validators/collections.py +31 -0
  33. synapse_sdk/devtools/config.py +94 -0
  34. synapse_sdk/devtools/server.py +41 -0
  35. synapse_sdk/devtools/streamlit_app/__init__.py +5 -0
  36. synapse_sdk/devtools/streamlit_app/app.py +128 -0
  37. synapse_sdk/devtools/streamlit_app/services/__init__.py +11 -0
  38. synapse_sdk/devtools/streamlit_app/services/job_service.py +233 -0
  39. synapse_sdk/devtools/streamlit_app/services/plugin_service.py +236 -0
  40. synapse_sdk/devtools/streamlit_app/services/serve_service.py +95 -0
  41. synapse_sdk/devtools/streamlit_app/ui/__init__.py +15 -0
  42. synapse_sdk/devtools/streamlit_app/ui/config_tab.py +76 -0
  43. synapse_sdk/devtools/streamlit_app/ui/deployment_tab.py +66 -0
  44. synapse_sdk/devtools/streamlit_app/ui/http_tab.py +125 -0
  45. synapse_sdk/devtools/streamlit_app/ui/jobs_tab.py +573 -0
  46. synapse_sdk/devtools/streamlit_app/ui/serve_tab.py +346 -0
  47. synapse_sdk/devtools/streamlit_app/ui/status_bar.py +118 -0
  48. synapse_sdk/devtools/streamlit_app/utils/__init__.py +40 -0
  49. synapse_sdk/devtools/streamlit_app/utils/json_viewer.py +197 -0
  50. synapse_sdk/devtools/streamlit_app/utils/log_formatter.py +38 -0
  51. synapse_sdk/devtools/streamlit_app/utils/styles.py +241 -0
  52. synapse_sdk/devtools/streamlit_app/utils/ui_components.py +289 -0
  53. synapse_sdk/devtools/streamlit_app.py +10 -0
  54. synapse_sdk/loggers.py +120 -9
  55. synapse_sdk/plugins/README.md +1340 -0
  56. synapse_sdk/plugins/__init__.py +0 -13
  57. synapse_sdk/plugins/categories/base.py +117 -11
  58. synapse_sdk/plugins/categories/data_validation/actions/validation.py +72 -0
  59. synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py +33 -5
  60. synapse_sdk/plugins/categories/export/actions/__init__.py +3 -0
  61. synapse_sdk/plugins/categories/export/actions/export/__init__.py +28 -0
  62. synapse_sdk/plugins/categories/export/actions/export/action.py +165 -0
  63. synapse_sdk/plugins/categories/export/actions/export/enums.py +113 -0
  64. synapse_sdk/plugins/categories/export/actions/export/exceptions.py +53 -0
  65. synapse_sdk/plugins/categories/export/actions/export/models.py +74 -0
  66. synapse_sdk/plugins/categories/export/actions/export/run.py +195 -0
  67. synapse_sdk/plugins/categories/export/actions/export/utils.py +187 -0
  68. synapse_sdk/plugins/categories/export/templates/config.yaml +21 -0
  69. synapse_sdk/plugins/categories/export/templates/plugin/__init__.py +390 -0
  70. synapse_sdk/plugins/categories/export/templates/plugin/export.py +160 -0
  71. synapse_sdk/plugins/categories/neural_net/actions/deployment.py +13 -12
  72. synapse_sdk/plugins/categories/neural_net/actions/train.py +1134 -31
  73. synapse_sdk/plugins/categories/neural_net/actions/tune.py +534 -0
  74. synapse_sdk/plugins/categories/neural_net/base/inference.py +1 -1
  75. synapse_sdk/plugins/categories/neural_net/templates/config.yaml +32 -4
  76. synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py +26 -10
  77. synapse_sdk/plugins/categories/pre_annotation/actions/__init__.py +4 -0
  78. synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/__init__.py +3 -0
  79. synapse_sdk/plugins/categories/{export/actions/export.py → pre_annotation/actions/pre_annotation/action.py} +4 -4
  80. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/__init__.py +28 -0
  81. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/action.py +148 -0
  82. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/enums.py +269 -0
  83. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/exceptions.py +14 -0
  84. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/factory.py +76 -0
  85. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/models.py +100 -0
  86. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/orchestrator.py +248 -0
  87. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/run.py +64 -0
  88. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/__init__.py +17 -0
  89. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/annotation.py +265 -0
  90. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/base.py +170 -0
  91. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/extraction.py +83 -0
  92. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/metrics.py +92 -0
  93. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/preprocessor.py +243 -0
  94. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/validation.py +143 -0
  95. synapse_sdk/plugins/categories/pre_annotation/templates/config.yaml +19 -0
  96. synapse_sdk/plugins/categories/pre_annotation/templates/plugin/to_task.py +40 -0
  97. synapse_sdk/plugins/categories/smart_tool/templates/config.yaml +2 -0
  98. synapse_sdk/plugins/categories/upload/__init__.py +0 -0
  99. synapse_sdk/plugins/categories/upload/actions/__init__.py +0 -0
  100. synapse_sdk/plugins/categories/upload/actions/upload/__init__.py +19 -0
  101. synapse_sdk/plugins/categories/upload/actions/upload/action.py +236 -0
  102. synapse_sdk/plugins/categories/upload/actions/upload/context.py +185 -0
  103. synapse_sdk/plugins/categories/upload/actions/upload/enums.py +493 -0
  104. synapse_sdk/plugins/categories/upload/actions/upload/exceptions.py +36 -0
  105. synapse_sdk/plugins/categories/upload/actions/upload/factory.py +138 -0
  106. synapse_sdk/plugins/categories/upload/actions/upload/models.py +214 -0
  107. synapse_sdk/plugins/categories/upload/actions/upload/orchestrator.py +183 -0
  108. synapse_sdk/plugins/categories/upload/actions/upload/registry.py +113 -0
  109. synapse_sdk/plugins/categories/upload/actions/upload/run.py +179 -0
  110. synapse_sdk/plugins/categories/upload/actions/upload/steps/__init__.py +1 -0
  111. synapse_sdk/plugins/categories/upload/actions/upload/steps/base.py +107 -0
  112. synapse_sdk/plugins/categories/upload/actions/upload/steps/cleanup.py +62 -0
  113. synapse_sdk/plugins/categories/upload/actions/upload/steps/collection.py +63 -0
  114. synapse_sdk/plugins/categories/upload/actions/upload/steps/generate.py +91 -0
  115. synapse_sdk/plugins/categories/upload/actions/upload/steps/initialize.py +82 -0
  116. synapse_sdk/plugins/categories/upload/actions/upload/steps/metadata.py +235 -0
  117. synapse_sdk/plugins/categories/upload/actions/upload/steps/organize.py +201 -0
  118. synapse_sdk/plugins/categories/upload/actions/upload/steps/upload.py +104 -0
  119. synapse_sdk/plugins/categories/upload/actions/upload/steps/validate.py +71 -0
  120. synapse_sdk/plugins/categories/upload/actions/upload/strategies/__init__.py +1 -0
  121. synapse_sdk/plugins/categories/upload/actions/upload/strategies/base.py +82 -0
  122. synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/__init__.py +1 -0
  123. synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/batch.py +39 -0
  124. synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/single.py +29 -0
  125. synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/__init__.py +1 -0
  126. synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/flat.py +300 -0
  127. synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/recursive.py +287 -0
  128. synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/__init__.py +1 -0
  129. synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/excel.py +174 -0
  130. synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/none.py +16 -0
  131. synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/__init__.py +1 -0
  132. synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/sync.py +84 -0
  133. synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/__init__.py +1 -0
  134. synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/default.py +60 -0
  135. synapse_sdk/plugins/categories/upload/actions/upload/utils.py +250 -0
  136. synapse_sdk/plugins/categories/upload/templates/README.md +470 -0
  137. synapse_sdk/plugins/categories/upload/templates/config.yaml +33 -0
  138. synapse_sdk/plugins/categories/upload/templates/plugin/__init__.py +310 -0
  139. synapse_sdk/plugins/categories/upload/templates/plugin/upload.py +102 -0
  140. synapse_sdk/plugins/enums.py +3 -1
  141. synapse_sdk/plugins/models.py +148 -11
  142. synapse_sdk/plugins/templates/plugin-config-schema.json +406 -0
  143. synapse_sdk/plugins/templates/schema.json +491 -0
  144. synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/config.yaml +1 -0
  145. synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/requirements.txt +1 -1
  146. synapse_sdk/plugins/utils/__init__.py +46 -0
  147. synapse_sdk/plugins/utils/actions.py +119 -0
  148. synapse_sdk/plugins/utils/config.py +203 -0
  149. synapse_sdk/plugins/{utils.py → utils/legacy.py} +26 -46
  150. synapse_sdk/plugins/utils/ray_gcs.py +66 -0
  151. synapse_sdk/plugins/utils/registry.py +58 -0
  152. synapse_sdk/shared/__init__.py +25 -0
  153. synapse_sdk/shared/enums.py +93 -0
  154. synapse_sdk/types.py +19 -0
  155. synapse_sdk/utils/converters/__init__.py +240 -0
  156. synapse_sdk/utils/converters/coco/__init__.py +0 -0
  157. synapse_sdk/utils/converters/coco/from_dm.py +322 -0
  158. synapse_sdk/utils/converters/coco/to_dm.py +215 -0
  159. synapse_sdk/utils/converters/dm/__init__.py +57 -0
  160. synapse_sdk/utils/converters/dm/base.py +137 -0
  161. synapse_sdk/utils/converters/dm/from_v1.py +273 -0
  162. synapse_sdk/utils/converters/dm/to_v1.py +321 -0
  163. synapse_sdk/utils/converters/dm/tools/__init__.py +214 -0
  164. synapse_sdk/utils/converters/dm/tools/answer.py +95 -0
  165. synapse_sdk/utils/converters/dm/tools/bounding_box.py +132 -0
  166. synapse_sdk/utils/converters/dm/tools/bounding_box_3d.py +121 -0
  167. synapse_sdk/utils/converters/dm/tools/classification.py +75 -0
  168. synapse_sdk/utils/converters/dm/tools/keypoint.py +117 -0
  169. synapse_sdk/utils/converters/dm/tools/named_entity.py +111 -0
  170. synapse_sdk/utils/converters/dm/tools/polygon.py +122 -0
  171. synapse_sdk/utils/converters/dm/tools/polyline.py +124 -0
  172. synapse_sdk/utils/converters/dm/tools/prompt.py +94 -0
  173. synapse_sdk/utils/converters/dm/tools/relation.py +86 -0
  174. synapse_sdk/utils/converters/dm/tools/segmentation.py +141 -0
  175. synapse_sdk/utils/converters/dm/tools/segmentation_3d.py +83 -0
  176. synapse_sdk/utils/converters/dm/types.py +168 -0
  177. synapse_sdk/utils/converters/dm/utils.py +162 -0
  178. synapse_sdk/utils/converters/dm_legacy/__init__.py +56 -0
  179. synapse_sdk/utils/converters/dm_legacy/from_v1.py +627 -0
  180. synapse_sdk/utils/converters/dm_legacy/to_v1.py +367 -0
  181. synapse_sdk/utils/converters/pascal/__init__.py +0 -0
  182. synapse_sdk/utils/converters/pascal/from_dm.py +244 -0
  183. synapse_sdk/utils/converters/pascal/to_dm.py +214 -0
  184. synapse_sdk/utils/converters/yolo/__init__.py +0 -0
  185. synapse_sdk/utils/converters/yolo/from_dm.py +384 -0
  186. synapse_sdk/utils/converters/yolo/to_dm.py +267 -0
  187. synapse_sdk/utils/dataset.py +46 -0
  188. synapse_sdk/utils/encryption.py +158 -0
  189. synapse_sdk/utils/file/__init__.py +58 -0
  190. synapse_sdk/utils/file/archive.py +32 -0
  191. synapse_sdk/utils/file/checksum.py +56 -0
  192. synapse_sdk/utils/file/chunking.py +31 -0
  193. synapse_sdk/utils/file/download.py +385 -0
  194. synapse_sdk/utils/file/encoding.py +40 -0
  195. synapse_sdk/utils/file/io.py +22 -0
  196. synapse_sdk/utils/file/upload.py +165 -0
  197. synapse_sdk/utils/file/video/__init__.py +29 -0
  198. synapse_sdk/utils/file/video/transcode.py +307 -0
  199. synapse_sdk/utils/file.py.backup +301 -0
  200. synapse_sdk/utils/http.py +138 -0
  201. synapse_sdk/utils/network.py +309 -0
  202. synapse_sdk/utils/storage/__init__.py +72 -0
  203. synapse_sdk/utils/storage/providers/__init__.py +183 -0
  204. synapse_sdk/utils/storage/providers/file_system.py +134 -0
  205. synapse_sdk/utils/storage/providers/gcp.py +13 -0
  206. synapse_sdk/utils/storage/providers/http.py +190 -0
  207. synapse_sdk/utils/storage/providers/s3.py +91 -0
  208. synapse_sdk/utils/storage/providers/sftp.py +47 -0
  209. synapse_sdk/utils/storage/registry.py +17 -0
  210. synapse_sdk-2025.12.3.dist-info/METADATA +123 -0
  211. synapse_sdk-2025.12.3.dist-info/RECORD +279 -0
  212. {synapse_sdk-1.0.0a23.dist-info → synapse_sdk-2025.12.3.dist-info}/WHEEL +1 -1
  213. synapse_sdk/clients/backend/dataset.py +0 -51
  214. synapse_sdk/plugins/categories/import/actions/import.py +0 -10
  215. synapse_sdk/plugins/cli/__init__.py +0 -21
  216. synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env +0 -24
  217. synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env.dist +0 -24
  218. synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/main.py +0 -4
  219. synapse_sdk/utils/file.py +0 -168
  220. synapse_sdk/utils/storage.py +0 -91
  221. synapse_sdk-1.0.0a23.dist-info/METADATA +0 -44
  222. synapse_sdk-1.0.0a23.dist-info/RECORD +0 -114
  223. /synapse_sdk/{plugins/cli → cli/plugin}/run.py +0 -0
  224. /synapse_sdk/{plugins/categories/import → clients/validators}/__init__.py +0 -0
  225. /synapse_sdk/{plugins/categories/import/actions → devtools}/__init__.py +0 -0
  226. {synapse_sdk-1.0.0a23.dist-info → synapse_sdk-2025.12.3.dist-info}/entry_points.txt +0 -0
  227. {synapse_sdk-1.0.0a23.dist-info → synapse_sdk-2025.12.3.dist-info/licenses}/LICENSE +0 -0
  228. {synapse_sdk-1.0.0a23.dist-info → synapse_sdk-2025.12.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,491 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://synapse.sh/schemas/plugin-config.json",
4
+ "title": "Synapse Plugin Configuration",
5
+ "description": "JSON Schema for validating Synapse plugin config.yaml files",
6
+ "type": "object",
7
+ "required": ["name", "code", "version", "category"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "name": {
11
+ "type": "string",
12
+ "description": "Human-readable name of the plugin",
13
+ "minLength": 1,
14
+ "maxLength": 100
15
+ },
16
+ "code": {
17
+ "type": "string",
18
+ "description": "Unique identifier for the plugin",
19
+ "pattern": "^[a-z0-9_-]+$",
20
+ "minLength": 1,
21
+ "maxLength": 50
22
+ },
23
+ "version": {
24
+ "type": "string",
25
+ "description": "Semantic version of the plugin",
26
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$"
27
+ },
28
+ "description": {
29
+ "type": "string",
30
+ "description": "Brief description of plugin functionality",
31
+ "maxLength": 500
32
+ },
33
+ "readme": {
34
+ "type": "string",
35
+ "description": "Path to README file relative to plugin root",
36
+ "default": "README.md"
37
+ },
38
+ "category": {
39
+ "$ref": "#/$defs/PluginCategory"
40
+ },
41
+ "package_manager": {
42
+ "type": "string",
43
+ "description": "Package manager for plugin dependencies",
44
+ "enum": ["pip", "uv"],
45
+ "default": "pip"
46
+ },
47
+ "package_manager_options": {
48
+ "type": "array",
49
+ "description": "User-provided options for package manager install command. Currently only supported for uv in Ray 2.44.1 (defaults to ['--no-cache']). pip_install_options requires newer Ray versions.",
50
+ "items": {
51
+ "type": "string"
52
+ }
53
+ },
54
+ "data_type": {
55
+ "type": "string",
56
+ "description": "Primary data type handled by the plugin",
57
+ "enum": ["image", "text", "video", "pcd", "audio"]
58
+ },
59
+ "tasks": {
60
+ "type": "array",
61
+ "description": "List of tasks this plugin can perform",
62
+ "items": {
63
+ "type": "string",
64
+ "pattern": "^[a-z]+\\.[a-z_]+$",
65
+ "description": "Task in format: data_type.task_name"
66
+ },
67
+ "uniqueItems": true
68
+ },
69
+ "supported_data_type": {
70
+ "type": "array",
71
+ "description": "Data types supported by upload plugins",
72
+ "items": {
73
+ "type": "string",
74
+ "enum": ["image", "text", "video", "pcd", "audio"]
75
+ },
76
+ "uniqueItems": true
77
+ },
78
+ "annotation_category": {
79
+ "type": "string",
80
+ "description": "Annotation category for smart tools",
81
+ "enum": ["object_detection", "classification", "segmentation", "keypoint", "text"]
82
+ },
83
+ "annotation_type": {
84
+ "type": "string",
85
+ "description": "Specific annotation type for smart tools",
86
+ "enum": ["bbox", "polygon", "point", "line", "mask", "label"]
87
+ },
88
+ "smart_tool": {
89
+ "type": "string",
90
+ "description": "Type of smart tool implementation",
91
+ "enum": ["interactive", "automatic", "semi_automatic"]
92
+ },
93
+ "actions": {
94
+ "type": "object",
95
+ "description": "Available actions for this plugin",
96
+ "patternProperties": {
97
+ "^[a-z_]+$": {
98
+ "$ref": "#/$defs/ActionConfig"
99
+ }
100
+ },
101
+ "additionalProperties": false
102
+ }
103
+ },
104
+ "allOf": [
105
+ {
106
+ "if": {
107
+ "properties": {
108
+ "category": { "const": "neural_net" }
109
+ }
110
+ },
111
+ "then": {
112
+ "required": ["data_type", "tasks"],
113
+ "properties": {
114
+ "actions": {
115
+ "type": "object",
116
+ "patternProperties": {
117
+ "^(train|inference|test|deployment|gradio|tune)$": {
118
+ "$ref": "#/$defs/ActionConfig"
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ },
125
+ {
126
+ "if": {
127
+ "properties": {
128
+ "category": { "const": "smart_tool" }
129
+ }
130
+ },
131
+ "then": {
132
+ "required": ["annotation_category", "annotation_type", "smart_tool"],
133
+ "properties": {
134
+ "actions": {
135
+ "type": "object",
136
+ "patternProperties": {
137
+ "^(auto_label)$": {
138
+ "$ref": "#/$defs/ActionConfig"
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ },
145
+ {
146
+ "if": {
147
+ "properties": {
148
+ "category": { "const": "upload" }
149
+ }
150
+ },
151
+ "then": {
152
+ "required": ["supported_data_type"],
153
+ "properties": {
154
+ "actions": {
155
+ "type": "object",
156
+ "patternProperties": {
157
+ "^(upload)$": {
158
+ "$ref": "#/$defs/ActionConfig"
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
+ ],
166
+ "$defs": {
167
+ "PluginCategory": {
168
+ "type": "string",
169
+ "description": "Category classification for the plugin",
170
+ "enum": [
171
+ "neural_net",
172
+ "export",
173
+ "upload",
174
+ "smart_tool",
175
+ "post_annotation",
176
+ "pre_annotation",
177
+ "data_validation"
178
+ ]
179
+ },
180
+ "RunMethod": {
181
+ "type": "string",
182
+ "description": "Execution method for the action",
183
+ "enum": ["job", "task", "restapi"],
184
+ "default": "job"
185
+ },
186
+ "ActionConfig": {
187
+ "type": "object",
188
+ "description": "Configuration for a plugin action",
189
+ "required": ["entrypoint"],
190
+ "additionalProperties": false,
191
+ "properties": {
192
+ "entrypoint": {
193
+ "type": "string",
194
+ "description": "Python module path to action implementation",
195
+ "pattern": "^[a-zA-Z_][a-zA-Z0-9_.]*$"
196
+ },
197
+ "method": {
198
+ "$ref": "#/$defs/RunMethod"
199
+ },
200
+ "dataset": {
201
+ "type": "string",
202
+ "description": "Dataset identifier for the action"
203
+ },
204
+ "endpoints": {
205
+ "type": "array",
206
+ "description": "REST API endpoints for restapi method",
207
+ "items": {
208
+ "$ref": "#/$defs/EndpointConfig"
209
+ }
210
+ },
211
+ "hyperparameters": {
212
+ "$ref": "#/$defs/HyperparametersSchema"
213
+ },
214
+ "metrics": {
215
+ "$ref": "#/$defs/MetricsConfig"
216
+ },
217
+ "visualizations": {
218
+ "$ref": "#/$defs/VisualizationsConfig"
219
+ },
220
+ "options": {
221
+ "type": "object",
222
+ "description": "Additional configuration options",
223
+ "additionalProperties": true
224
+ },
225
+ "ui_schema": {
226
+ "type": "object",
227
+ "description": "FormKit UI schema for action parameters",
228
+ "additionalProperties": true
229
+ }
230
+ }
231
+ },
232
+ "EndpointConfig": {
233
+ "type": "object",
234
+ "description": "REST API endpoint configuration",
235
+ "required": ["method", "path"],
236
+ "additionalProperties": false,
237
+ "properties": {
238
+ "method": {
239
+ "type": "string",
240
+ "description": "HTTP method",
241
+ "enum": ["GET", "POST", "PUT", "DELETE", "PATCH"]
242
+ },
243
+ "path": {
244
+ "type": "string",
245
+ "description": "API endpoint path",
246
+ "pattern": "^/.*"
247
+ },
248
+ "description": {
249
+ "type": "string",
250
+ "description": "Endpoint description"
251
+ }
252
+ }
253
+ },
254
+ "HyperparametersSchema": {
255
+ "type": "object",
256
+ "description": "FormKit schema for hyperparameter configuration",
257
+ "additionalProperties": true,
258
+ "properties": {
259
+ "$formkit": {
260
+ "type": "string",
261
+ "const": "group"
262
+ },
263
+ "children": {
264
+ "type": "array",
265
+ "items": {
266
+ "$ref": "#/$defs/FormKitField"
267
+ }
268
+ }
269
+ }
270
+ },
271
+ "FormKitField": {
272
+ "type": "object",
273
+ "description": "FormKit field configuration",
274
+ "required": ["$formkit", "name"],
275
+ "properties": {
276
+ "$formkit": {
277
+ "type": "string",
278
+ "enum": ["text", "number", "select", "checkbox", "group", "list"]
279
+ },
280
+ "name": {
281
+ "type": "string",
282
+ "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
283
+ },
284
+ "label": {
285
+ "type": "string"
286
+ },
287
+ "help": {
288
+ "type": "string"
289
+ },
290
+ "value": {
291
+ "description": "Default value for the field"
292
+ },
293
+ "validation": {
294
+ "type": "string",
295
+ "description": "Validation rules"
296
+ },
297
+ "options": {
298
+ "type": "array",
299
+ "description": "Options for select fields",
300
+ "items": {
301
+ "type": "object",
302
+ "properties": {
303
+ "label": { "type": "string" },
304
+ "value": {}
305
+ }
306
+ }
307
+ },
308
+ "children": {
309
+ "type": "array",
310
+ "items": {
311
+ "$ref": "#/$defs/FormKitField"
312
+ }
313
+ }
314
+ },
315
+ "additionalProperties": true
316
+ },
317
+ "MetricsConfig": {
318
+ "type": "object",
319
+ "description": "Metrics tracking configuration",
320
+ "additionalProperties": false,
321
+ "properties": {
322
+ "epoch": {
323
+ "type": "array",
324
+ "description": "Per-epoch metrics to track",
325
+ "items": {
326
+ "type": "string"
327
+ }
328
+ },
329
+ "validation": {
330
+ "type": "array",
331
+ "description": "Validation metrics to track",
332
+ "items": {
333
+ "type": "string"
334
+ }
335
+ }
336
+ }
337
+ },
338
+ "VisualizationsConfig": {
339
+ "type": "object",
340
+ "description": "Training visualization configuration",
341
+ "additionalProperties": false,
342
+ "properties": {
343
+ "images": {
344
+ "$ref": "#/$defs/ImageVisualization"
345
+ },
346
+ "charts": {
347
+ "type": "array",
348
+ "description": "Chart visualizations",
349
+ "items": {
350
+ "$ref": "#/$defs/ChartVisualization"
351
+ }
352
+ }
353
+ }
354
+ },
355
+ "ImageVisualization": {
356
+ "type": "object",
357
+ "description": "Image grid visualization configuration",
358
+ "required": ["type"],
359
+ "additionalProperties": false,
360
+ "properties": {
361
+ "type": {
362
+ "type": "string",
363
+ "const": "image_grid"
364
+ },
365
+ "title": {
366
+ "type": "string",
367
+ "description": "Title for the image grid"
368
+ },
369
+ "columns": {
370
+ "type": "integer",
371
+ "description": "Number of columns in grid",
372
+ "minimum": 1,
373
+ "default": 3
374
+ },
375
+ "max_images": {
376
+ "type": "integer",
377
+ "description": "Maximum number of images to display",
378
+ "minimum": 1,
379
+ "default": 9
380
+ }
381
+ }
382
+ },
383
+ "ChartVisualization": {
384
+ "type": "object",
385
+ "description": "Chart visualization configuration",
386
+ "required": ["type", "title", "x_axis", "y_axis"],
387
+ "additionalProperties": false,
388
+ "properties": {
389
+ "type": {
390
+ "type": "string",
391
+ "enum": ["line", "bar", "scatter"]
392
+ },
393
+ "title": {
394
+ "type": "string",
395
+ "description": "Chart title"
396
+ },
397
+ "x_axis": {
398
+ "type": "string",
399
+ "description": "X-axis metric name"
400
+ },
401
+ "y_axis": {
402
+ "type": "string",
403
+ "description": "Y-axis metric name"
404
+ }
405
+ }
406
+ }
407
+ },
408
+ "examples": [
409
+ {
410
+ "name": "YOLO Object Detection",
411
+ "code": "yolo_detection",
412
+ "version": "1.0.0",
413
+ "description": "YOLO-based object detection model",
414
+ "category": "neural_net",
415
+ "package_manager": "uv",
416
+ "data_type": "image",
417
+ "tasks": ["image.object_detection"],
418
+ "actions": {
419
+ "train": {
420
+ "entrypoint": "plugin.train.train",
421
+ "method": "job",
422
+ "dataset": "coco",
423
+ "hyperparameters": {
424
+ "$formkit": "group",
425
+ "children": [
426
+ {
427
+ "$formkit": "number",
428
+ "name": "epochs",
429
+ "label": "Epochs",
430
+ "value": 100,
431
+ "validation": "required|min:1"
432
+ },
433
+ {
434
+ "$formkit": "number",
435
+ "name": "batch_size",
436
+ "label": "Batch Size",
437
+ "value": 16,
438
+ "validation": "required|min:1"
439
+ }
440
+ ]
441
+ }
442
+ },
443
+ "inference": {
444
+ "entrypoint": "plugin.inference.inference",
445
+ "method": "restapi",
446
+ "endpoints": [
447
+ {
448
+ "method": "POST",
449
+ "path": "/predict",
450
+ "description": "Run object detection inference"
451
+ }
452
+ ]
453
+ }
454
+ }
455
+ },
456
+ {
457
+ "name": "Auto Labeling Tool",
458
+ "code": "smart_labeler",
459
+ "version": "1.0.0",
460
+ "description": "Intelligent auto-labeling for object detection",
461
+ "category": "smart_tool",
462
+ "annotation_category": "object_detection",
463
+ "annotation_type": "bbox",
464
+ "smart_tool": "semi_automatic",
465
+ "actions": {
466
+ "auto_label": {
467
+ "entrypoint": "plugin.label.auto_label",
468
+ "method": "job"
469
+ }
470
+ }
471
+ },
472
+ {
473
+ "name": "Dataset Uploader",
474
+ "code": "dataset_upload",
475
+ "version": "1.0.0",
476
+ "description": "Upload datasets to cloud storage",
477
+ "category": "upload",
478
+ "supported_data_type": ["image", "video"],
479
+ "actions": {
480
+ "upload": {
481
+ "entrypoint": "plugin.upload.upload",
482
+ "method": "task",
483
+ "options": {
484
+ "chunk_size": 1024,
485
+ "parallel_uploads": 4
486
+ }
487
+ }
488
+ }
489
+ }
490
+ ]
491
+ }
@@ -4,3 +4,4 @@ version: {{ cookiecutter.version }}
4
4
  readme: README.md
5
5
  description: {{ cookiecutter.description }}
6
6
  category: {{ cookiecutter.category }}
7
+ package_manager: pip
@@ -1 +1 @@
1
- synapse-sdk[all]
1
+ synapse-sdk[all]
@@ -0,0 +1,46 @@
1
+ # New utilities
2
+ from .actions import (
3
+ get_action,
4
+ get_action_class,
5
+ get_available_actions,
6
+ is_action_available,
7
+ )
8
+ from .config import (
9
+ get_action_config,
10
+ get_plugin_actions,
11
+ get_plugin_metadata,
12
+ read_plugin_config,
13
+ validate_plugin_config,
14
+ )
15
+
16
+ # Import legacy functions for backward compatibility
17
+ from .legacy import read_requirements, run_plugin
18
+ from .ray_gcs import convert_http_to_ray_gcs
19
+ from .registry import (
20
+ get_category_display_name,
21
+ get_plugin_categories,
22
+ is_valid_category,
23
+ )
24
+
25
+ __all__ = [
26
+ # Config utilities
27
+ 'get_plugin_actions',
28
+ 'get_action_config',
29
+ 'read_plugin_config',
30
+ 'validate_plugin_config',
31
+ 'get_plugin_metadata',
32
+ # Action utilities
33
+ 'get_action',
34
+ 'get_action_class',
35
+ 'get_available_actions',
36
+ 'is_action_available',
37
+ # Registry utilities
38
+ 'get_plugin_categories',
39
+ 'is_valid_category',
40
+ 'get_category_display_name',
41
+ # Ray utilities
42
+ 'convert_http_to_ray_gcs',
43
+ # Legacy utilities for backward compatibility
44
+ 'read_requirements',
45
+ 'run_plugin',
46
+ ]
@@ -0,0 +1,119 @@
1
+ """Plugin action utilities."""
2
+
3
+ import json
4
+ from typing import Any, Dict, Union
5
+
6
+ from synapse_sdk.plugins.categories.registry import _REGISTERED_ACTIONS, register_actions
7
+ from synapse_sdk.utils.file import get_dict_from_file
8
+
9
+ from .config import read_plugin_config
10
+
11
+
12
+ def get_action(action: str, params_data: Union[str, Dict[str, Any]], *args, **kwargs):
13
+ """Get a plugin action instance with validated parameters.
14
+
15
+ Args:
16
+ action: Name of the action to get.
17
+ params_data: Parameters as string (JSON/file path) or dictionary.
18
+ *args: Additional positional arguments.
19
+ **kwargs: Additional keyword arguments including 'config'.
20
+
21
+ Returns:
22
+ Configured action instance ready for execution.
23
+
24
+ Raises:
25
+ ActionError: If parameters are invalid or action not found.
26
+ """
27
+ if isinstance(params_data, str):
28
+ try:
29
+ params = json.loads(params_data)
30
+ except json.JSONDecodeError:
31
+ params = get_dict_from_file(params_data)
32
+ else:
33
+ params = params_data
34
+
35
+ config_data = kwargs.pop('config', False)
36
+ if config_data:
37
+ if isinstance(config_data, str):
38
+ config = read_plugin_config(plugin_path=config_data)
39
+ else:
40
+ config = config_data
41
+ else:
42
+ config = read_plugin_config()
43
+
44
+ category = config['category']
45
+ return get_action_class(category, action)(params, config, *args, **kwargs)
46
+
47
+
48
+ def get_action_class(category: str, action: str):
49
+ """Get action class by category and action name.
50
+
51
+ Args:
52
+ category: Plugin category (e.g., 'neural_net', 'export').
53
+ action: Action name (e.g., 'train', 'inference').
54
+
55
+ Returns:
56
+ Action class ready for instantiation.
57
+
58
+ Raises:
59
+ KeyError: If category or action not found in registry.
60
+ """
61
+ register_actions()
62
+ try:
63
+ return _REGISTERED_ACTIONS[category][action]
64
+ except KeyError as e:
65
+ if category not in _REGISTERED_ACTIONS:
66
+ available_categories = list(_REGISTERED_ACTIONS.keys())
67
+ raise KeyError(f"Category '{category}' not found. Available categories: {available_categories}") from e
68
+ else:
69
+ available_actions = list(_REGISTERED_ACTIONS[category].keys())
70
+ raise KeyError(
71
+ f"Action '{action}' not found in category '{category}'. Available actions: {available_actions}"
72
+ ) from e
73
+
74
+
75
+ def get_available_actions(category: str) -> list:
76
+ """Get list of available actions for a plugin category.
77
+
78
+ Args:
79
+ category: Plugin category to get actions for.
80
+
81
+ Returns:
82
+ List of available action names.
83
+
84
+ Raises:
85
+ KeyError: If category not found in registry.
86
+
87
+ Examples:
88
+ >>> get_available_actions('neural_net')
89
+ ['train', 'inference', 'test', 'deployment', 'gradio', 'tune']
90
+ """
91
+ register_actions()
92
+ if category not in _REGISTERED_ACTIONS:
93
+ available_categories = list(_REGISTERED_ACTIONS.keys())
94
+ raise KeyError(f"Category '{category}' not found. Available categories: {available_categories}")
95
+
96
+ return list(_REGISTERED_ACTIONS[category].keys())
97
+
98
+
99
+ def is_action_available(category: str, action: str) -> bool:
100
+ """Check if an action is available in a given category.
101
+
102
+ Args:
103
+ category: Plugin category to check.
104
+ action: Action name to check.
105
+
106
+ Returns:
107
+ True if action is available, False otherwise.
108
+
109
+ Examples:
110
+ >>> is_action_available('neural_net', 'train')
111
+ True
112
+ >>> is_action_available('neural_net', 'nonexistent')
113
+ False
114
+ """
115
+ try:
116
+ available_actions = get_available_actions(category)
117
+ return action in available_actions
118
+ except KeyError:
119
+ return False