synapse-sdk 1.0.0a35__py3-none-any.whl → 2025.11.7__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 (307) hide show
  1. synapse_sdk/__init__.py +24 -0
  2. synapse_sdk/cli/__init__.py +308 -5
  3. synapse_sdk/cli/alias/utils.py +1 -1
  4. synapse_sdk/cli/code_server.py +687 -0
  5. synapse_sdk/cli/config.py +440 -0
  6. synapse_sdk/cli/devtools.py +90 -0
  7. synapse_sdk/cli/plugin/publish.py +23 -15
  8. synapse_sdk/clients/agent/__init__.py +9 -3
  9. synapse_sdk/clients/agent/container.py +133 -0
  10. synapse_sdk/clients/agent/core.py +19 -0
  11. synapse_sdk/clients/agent/ray.py +298 -9
  12. synapse_sdk/clients/backend/__init__.py +28 -12
  13. synapse_sdk/clients/backend/annotation.py +9 -1
  14. synapse_sdk/clients/backend/core.py +31 -4
  15. synapse_sdk/clients/backend/data_collection.py +186 -0
  16. synapse_sdk/clients/backend/hitl.py +1 -1
  17. synapse_sdk/clients/backend/integration.py +4 -3
  18. synapse_sdk/clients/backend/ml.py +1 -1
  19. synapse_sdk/clients/backend/models.py +35 -1
  20. synapse_sdk/clients/base.py +309 -36
  21. synapse_sdk/clients/ray/serve.py +2 -0
  22. synapse_sdk/devtools/__init__.py +0 -0
  23. synapse_sdk/devtools/config.py +94 -0
  24. synapse_sdk/devtools/docs/.gitignore +20 -0
  25. synapse_sdk/devtools/docs/README.md +41 -0
  26. synapse_sdk/devtools/docs/blog/2019-05-28-first-blog-post.md +12 -0
  27. synapse_sdk/devtools/docs/blog/2019-05-29-long-blog-post.md +44 -0
  28. synapse_sdk/devtools/docs/blog/2021-08-01-mdx-blog-post.mdx +24 -0
  29. synapse_sdk/devtools/docs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
  30. synapse_sdk/devtools/docs/blog/2021-08-26-welcome/index.md +29 -0
  31. synapse_sdk/devtools/docs/blog/authors.yml +25 -0
  32. synapse_sdk/devtools/docs/blog/tags.yml +19 -0
  33. synapse_sdk/devtools/docs/docs/api/clients/agent.md +43 -0
  34. synapse_sdk/devtools/docs/docs/api/clients/annotation-mixin.md +378 -0
  35. synapse_sdk/devtools/docs/docs/api/clients/backend.md +420 -0
  36. synapse_sdk/devtools/docs/docs/api/clients/base.md +257 -0
  37. synapse_sdk/devtools/docs/docs/api/clients/core-mixin.md +477 -0
  38. synapse_sdk/devtools/docs/docs/api/clients/data-collection-mixin.md +422 -0
  39. synapse_sdk/devtools/docs/docs/api/clients/hitl-mixin.md +554 -0
  40. synapse_sdk/devtools/docs/docs/api/clients/index.md +391 -0
  41. synapse_sdk/devtools/docs/docs/api/clients/integration-mixin.md +571 -0
  42. synapse_sdk/devtools/docs/docs/api/clients/ml-mixin.md +578 -0
  43. synapse_sdk/devtools/docs/docs/api/clients/ray.md +342 -0
  44. synapse_sdk/devtools/docs/docs/api/index.md +52 -0
  45. synapse_sdk/devtools/docs/docs/api/plugins/categories.md +43 -0
  46. synapse_sdk/devtools/docs/docs/api/plugins/models.md +114 -0
  47. synapse_sdk/devtools/docs/docs/api/plugins/utils.md +328 -0
  48. synapse_sdk/devtools/docs/docs/categories.md +0 -0
  49. synapse_sdk/devtools/docs/docs/cli-usage.md +280 -0
  50. synapse_sdk/devtools/docs/docs/concepts/index.md +38 -0
  51. synapse_sdk/devtools/docs/docs/configuration.md +83 -0
  52. synapse_sdk/devtools/docs/docs/contributing.md +306 -0
  53. synapse_sdk/devtools/docs/docs/examples/index.md +29 -0
  54. synapse_sdk/devtools/docs/docs/faq.md +179 -0
  55. synapse_sdk/devtools/docs/docs/features/converters/index.md +455 -0
  56. synapse_sdk/devtools/docs/docs/features/index.md +24 -0
  57. synapse_sdk/devtools/docs/docs/features/utils/file.md +415 -0
  58. synapse_sdk/devtools/docs/docs/features/utils/network.md +378 -0
  59. synapse_sdk/devtools/docs/docs/features/utils/storage.md +57 -0
  60. synapse_sdk/devtools/docs/docs/features/utils/types.md +51 -0
  61. synapse_sdk/devtools/docs/docs/installation.md +94 -0
  62. synapse_sdk/devtools/docs/docs/introduction.md +47 -0
  63. synapse_sdk/devtools/docs/docs/plugins/categories/neural-net-plugins/train-action-overview.md +814 -0
  64. synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
  65. synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
  66. synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
  67. synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
  68. synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-action.md +948 -0
  69. synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-overview.md +544 -0
  70. synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-template.md +766 -0
  71. synapse_sdk/devtools/docs/docs/plugins/export-plugins.md +1092 -0
  72. synapse_sdk/devtools/docs/docs/plugins/plugins.md +852 -0
  73. synapse_sdk/devtools/docs/docs/quickstart.md +78 -0
  74. synapse_sdk/devtools/docs/docs/troubleshooting.md +519 -0
  75. synapse_sdk/devtools/docs/docs/tutorial-basics/_category_.json +8 -0
  76. synapse_sdk/devtools/docs/docs/tutorial-basics/congratulations.md +23 -0
  77. synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-blog-post.md +34 -0
  78. synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-document.md +57 -0
  79. synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-page.md +43 -0
  80. synapse_sdk/devtools/docs/docs/tutorial-basics/deploy-your-site.md +31 -0
  81. synapse_sdk/devtools/docs/docs/tutorial-basics/markdown-features.mdx +152 -0
  82. synapse_sdk/devtools/docs/docs/tutorial-extras/_category_.json +7 -0
  83. synapse_sdk/devtools/docs/docs/tutorial-extras/img/docsVersionDropdown.png +0 -0
  84. synapse_sdk/devtools/docs/docs/tutorial-extras/img/localeDropdown.png +0 -0
  85. synapse_sdk/devtools/docs/docs/tutorial-extras/manage-docs-versions.md +55 -0
  86. synapse_sdk/devtools/docs/docs/tutorial-extras/translate-your-site.md +88 -0
  87. synapse_sdk/devtools/docs/docusaurus.config.ts +148 -0
  88. synapse_sdk/devtools/docs/i18n/ko/code.json +325 -0
  89. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/agent.md +43 -0
  90. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/annotation-mixin.md +289 -0
  91. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/backend.md +420 -0
  92. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/base.md +257 -0
  93. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/core-mixin.md +417 -0
  94. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/data-collection-mixin.md +356 -0
  95. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/hitl-mixin.md +192 -0
  96. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/index.md +391 -0
  97. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/integration-mixin.md +479 -0
  98. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/ml-mixin.md +284 -0
  99. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/ray.md +342 -0
  100. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/index.md +52 -0
  101. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/plugins/models.md +114 -0
  102. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/categories.md +0 -0
  103. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/cli-usage.md +280 -0
  104. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/concepts/index.md +38 -0
  105. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/configuration.md +83 -0
  106. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/contributing.md +306 -0
  107. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/examples/index.md +29 -0
  108. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/faq.md +179 -0
  109. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/converters/index.md +30 -0
  110. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/index.md +24 -0
  111. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/file.md +415 -0
  112. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/network.md +378 -0
  113. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/storage.md +60 -0
  114. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/types.md +51 -0
  115. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/installation.md +94 -0
  116. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/introduction.md +47 -0
  117. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/neural-net-plugins/train-action-overview.md +815 -0
  118. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
  119. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
  120. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
  121. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
  122. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-action.md +948 -0
  123. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-overview.md +544 -0
  124. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-template.md +766 -0
  125. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/export-plugins.md +1092 -0
  126. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/plugins.md +117 -0
  127. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/quickstart.md +78 -0
  128. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/troubleshooting.md +519 -0
  129. synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current.json +34 -0
  130. synapse_sdk/devtools/docs/i18n/ko/docusaurus-theme-classic/footer.json +42 -0
  131. synapse_sdk/devtools/docs/i18n/ko/docusaurus-theme-classic/navbar.json +18 -0
  132. synapse_sdk/devtools/docs/package-lock.json +18784 -0
  133. synapse_sdk/devtools/docs/package.json +48 -0
  134. synapse_sdk/devtools/docs/sidebars.ts +122 -0
  135. synapse_sdk/devtools/docs/src/components/HomepageFeatures/index.tsx +71 -0
  136. synapse_sdk/devtools/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  137. synapse_sdk/devtools/docs/src/css/custom.css +30 -0
  138. synapse_sdk/devtools/docs/src/pages/index.module.css +23 -0
  139. synapse_sdk/devtools/docs/src/pages/index.tsx +21 -0
  140. synapse_sdk/devtools/docs/src/pages/markdown-page.md +7 -0
  141. synapse_sdk/devtools/docs/static/.nojekyll +0 -0
  142. synapse_sdk/devtools/docs/static/img/docusaurus-social-card.jpg +0 -0
  143. synapse_sdk/devtools/docs/static/img/docusaurus.png +0 -0
  144. synapse_sdk/devtools/docs/static/img/favicon.ico +0 -0
  145. synapse_sdk/devtools/docs/static/img/logo.png +0 -0
  146. synapse_sdk/devtools/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  147. synapse_sdk/devtools/docs/static/img/undraw_docusaurus_react.svg +170 -0
  148. synapse_sdk/devtools/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  149. synapse_sdk/devtools/docs/tsconfig.json +8 -0
  150. synapse_sdk/devtools/server.py +41 -0
  151. synapse_sdk/devtools/streamlit_app/__init__.py +5 -0
  152. synapse_sdk/devtools/streamlit_app/app.py +128 -0
  153. synapse_sdk/devtools/streamlit_app/services/__init__.py +11 -0
  154. synapse_sdk/devtools/streamlit_app/services/job_service.py +233 -0
  155. synapse_sdk/devtools/streamlit_app/services/plugin_service.py +236 -0
  156. synapse_sdk/devtools/streamlit_app/services/serve_service.py +95 -0
  157. synapse_sdk/devtools/streamlit_app/ui/__init__.py +15 -0
  158. synapse_sdk/devtools/streamlit_app/ui/config_tab.py +76 -0
  159. synapse_sdk/devtools/streamlit_app/ui/deployment_tab.py +66 -0
  160. synapse_sdk/devtools/streamlit_app/ui/http_tab.py +125 -0
  161. synapse_sdk/devtools/streamlit_app/ui/jobs_tab.py +573 -0
  162. synapse_sdk/devtools/streamlit_app/ui/serve_tab.py +346 -0
  163. synapse_sdk/devtools/streamlit_app/ui/status_bar.py +118 -0
  164. synapse_sdk/devtools/streamlit_app/utils/__init__.py +40 -0
  165. synapse_sdk/devtools/streamlit_app/utils/json_viewer.py +197 -0
  166. synapse_sdk/devtools/streamlit_app/utils/log_formatter.py +38 -0
  167. synapse_sdk/devtools/streamlit_app/utils/styles.py +241 -0
  168. synapse_sdk/devtools/streamlit_app/utils/ui_components.py +289 -0
  169. synapse_sdk/devtools/streamlit_app.py +10 -0
  170. synapse_sdk/loggers.py +65 -7
  171. synapse_sdk/plugins/README.md +1340 -0
  172. synapse_sdk/plugins/categories/base.py +73 -11
  173. synapse_sdk/plugins/categories/data_validation/actions/validation.py +72 -0
  174. synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py +33 -5
  175. synapse_sdk/plugins/categories/export/actions/__init__.py +3 -0
  176. synapse_sdk/plugins/categories/export/actions/export/__init__.py +28 -0
  177. synapse_sdk/plugins/categories/export/actions/export/action.py +165 -0
  178. synapse_sdk/plugins/categories/export/actions/export/enums.py +113 -0
  179. synapse_sdk/plugins/categories/export/actions/export/exceptions.py +53 -0
  180. synapse_sdk/plugins/categories/export/actions/export/models.py +74 -0
  181. synapse_sdk/plugins/categories/export/actions/export/run.py +195 -0
  182. synapse_sdk/plugins/categories/export/actions/{export.py → export/utils.py} +47 -82
  183. synapse_sdk/plugins/categories/export/templates/config.yaml +19 -1
  184. synapse_sdk/plugins/categories/export/templates/plugin/__init__.py +390 -0
  185. synapse_sdk/plugins/categories/export/templates/plugin/export.py +153 -129
  186. synapse_sdk/plugins/categories/neural_net/actions/deployment.py +9 -62
  187. synapse_sdk/plugins/categories/neural_net/actions/train.py +1062 -32
  188. synapse_sdk/plugins/categories/neural_net/actions/tune.py +534 -0
  189. synapse_sdk/plugins/categories/neural_net/templates/config.yaml +27 -5
  190. synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py +26 -10
  191. synapse_sdk/plugins/categories/pre_annotation/actions/__init__.py +4 -0
  192. synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/__init__.py +3 -0
  193. synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/action.py +10 -0
  194. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/__init__.py +28 -0
  195. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/action.py +145 -0
  196. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/enums.py +269 -0
  197. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/exceptions.py +14 -0
  198. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/factory.py +76 -0
  199. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/models.py +97 -0
  200. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/orchestrator.py +250 -0
  201. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/run.py +64 -0
  202. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/__init__.py +17 -0
  203. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/annotation.py +287 -0
  204. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/base.py +170 -0
  205. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/extraction.py +83 -0
  206. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/metrics.py +87 -0
  207. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/preprocessor.py +127 -0
  208. synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/validation.py +143 -0
  209. synapse_sdk/plugins/categories/pre_annotation/actions/to_task.py +966 -0
  210. synapse_sdk/plugins/categories/pre_annotation/templates/config.yaml +19 -0
  211. synapse_sdk/plugins/categories/pre_annotation/templates/plugin/to_task.py +40 -0
  212. synapse_sdk/plugins/categories/upload/actions/upload/__init__.py +19 -0
  213. synapse_sdk/plugins/categories/upload/actions/upload/action.py +232 -0
  214. synapse_sdk/plugins/categories/upload/actions/upload/context.py +185 -0
  215. synapse_sdk/plugins/categories/upload/actions/upload/enums.py +471 -0
  216. synapse_sdk/plugins/categories/upload/actions/upload/exceptions.py +36 -0
  217. synapse_sdk/plugins/categories/upload/actions/upload/factory.py +138 -0
  218. synapse_sdk/plugins/categories/upload/actions/upload/models.py +203 -0
  219. synapse_sdk/plugins/categories/upload/actions/upload/orchestrator.py +183 -0
  220. synapse_sdk/plugins/categories/upload/actions/upload/registry.py +113 -0
  221. synapse_sdk/plugins/categories/upload/actions/upload/run.py +179 -0
  222. synapse_sdk/plugins/categories/upload/actions/upload/steps/__init__.py +1 -0
  223. synapse_sdk/plugins/categories/upload/actions/upload/steps/base.py +107 -0
  224. synapse_sdk/plugins/categories/upload/actions/upload/steps/cleanup.py +62 -0
  225. synapse_sdk/plugins/categories/upload/actions/upload/steps/collection.py +63 -0
  226. synapse_sdk/plugins/categories/upload/actions/upload/steps/generate.py +84 -0
  227. synapse_sdk/plugins/categories/upload/actions/upload/steps/initialize.py +82 -0
  228. synapse_sdk/plugins/categories/upload/actions/upload/steps/metadata.py +235 -0
  229. synapse_sdk/plugins/categories/upload/actions/upload/steps/organize.py +203 -0
  230. synapse_sdk/plugins/categories/upload/actions/upload/steps/upload.py +97 -0
  231. synapse_sdk/plugins/categories/upload/actions/upload/steps/validate.py +71 -0
  232. synapse_sdk/plugins/categories/upload/actions/upload/strategies/__init__.py +1 -0
  233. synapse_sdk/plugins/categories/upload/actions/upload/strategies/base.py +82 -0
  234. synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/__init__.py +1 -0
  235. synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/batch.py +39 -0
  236. synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/single.py +29 -0
  237. synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/__init__.py +1 -0
  238. synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/flat.py +258 -0
  239. synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/recursive.py +281 -0
  240. synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/__init__.py +1 -0
  241. synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/excel.py +174 -0
  242. synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/none.py +16 -0
  243. synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/__init__.py +1 -0
  244. synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/sync.py +84 -0
  245. synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/__init__.py +1 -0
  246. synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/default.py +60 -0
  247. synapse_sdk/plugins/categories/upload/actions/upload/utils.py +250 -0
  248. synapse_sdk/plugins/categories/upload/templates/README.md +470 -0
  249. synapse_sdk/plugins/categories/upload/templates/config.yaml +29 -2
  250. synapse_sdk/plugins/categories/upload/templates/plugin/__init__.py +294 -0
  251. synapse_sdk/plugins/categories/upload/templates/plugin/upload.py +88 -30
  252. synapse_sdk/plugins/models.py +122 -16
  253. synapse_sdk/plugins/templates/plugin-config-schema.json +406 -0
  254. synapse_sdk/plugins/templates/schema.json +491 -0
  255. synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/requirements.txt +1 -1
  256. synapse_sdk/plugins/utils/__init__.py +46 -0
  257. synapse_sdk/plugins/utils/actions.py +119 -0
  258. synapse_sdk/plugins/utils/config.py +203 -0
  259. synapse_sdk/plugins/{utils.py → utils/legacy.py} +26 -46
  260. synapse_sdk/plugins/utils/ray_gcs.py +66 -0
  261. synapse_sdk/plugins/utils/registry.py +58 -0
  262. synapse_sdk/shared/__init__.py +25 -0
  263. synapse_sdk/shared/enums.py +93 -0
  264. synapse_sdk/utils/converters/__init__.py +240 -0
  265. synapse_sdk/utils/converters/coco/__init__.py +0 -0
  266. synapse_sdk/utils/converters/coco/from_dm.py +322 -0
  267. synapse_sdk/utils/converters/coco/to_dm.py +215 -0
  268. synapse_sdk/utils/converters/dm/__init__.py +56 -0
  269. synapse_sdk/utils/converters/dm/from_v1.py +627 -0
  270. synapse_sdk/utils/converters/dm/to_v1.py +367 -0
  271. synapse_sdk/utils/converters/pascal/__init__.py +0 -0
  272. synapse_sdk/utils/converters/pascal/from_dm.py +244 -0
  273. synapse_sdk/utils/converters/pascal/to_dm.py +214 -0
  274. synapse_sdk/utils/converters/yolo/__init__.py +0 -0
  275. synapse_sdk/utils/converters/yolo/from_dm.py +384 -0
  276. synapse_sdk/utils/converters/yolo/to_dm.py +267 -0
  277. synapse_sdk/utils/dataset.py +46 -0
  278. synapse_sdk/utils/encryption.py +158 -0
  279. synapse_sdk/utils/file/__init__.py +39 -0
  280. synapse_sdk/utils/file/archive.py +32 -0
  281. synapse_sdk/utils/file/checksum.py +56 -0
  282. synapse_sdk/utils/file/chunking.py +31 -0
  283. synapse_sdk/utils/file/download.py +385 -0
  284. synapse_sdk/utils/file/encoding.py +40 -0
  285. synapse_sdk/utils/file/io.py +22 -0
  286. synapse_sdk/utils/file/video/__init__.py +29 -0
  287. synapse_sdk/utils/file/video/transcode.py +307 -0
  288. synapse_sdk/utils/{file.py → file.py.backup} +84 -2
  289. synapse_sdk/utils/http.py +138 -0
  290. synapse_sdk/utils/network.py +293 -0
  291. synapse_sdk/utils/storage/__init__.py +36 -2
  292. synapse_sdk/utils/storage/providers/__init__.py +141 -0
  293. synapse_sdk/utils/storage/providers/file_system.py +134 -0
  294. synapse_sdk/utils/storage/providers/http.py +190 -0
  295. synapse_sdk/utils/storage/providers/s3.py +54 -6
  296. synapse_sdk/utils/storage/providers/sftp.py +31 -0
  297. synapse_sdk/utils/storage/registry.py +6 -0
  298. synapse_sdk-2025.11.7.dist-info/METADATA +122 -0
  299. synapse_sdk-2025.11.7.dist-info/RECORD +386 -0
  300. {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-2025.11.7.dist-info}/WHEEL +1 -1
  301. synapse_sdk/clients/backend/dataset.py +0 -102
  302. synapse_sdk/plugins/categories/upload/actions/upload.py +0 -293
  303. synapse_sdk-1.0.0a35.dist-info/METADATA +0 -47
  304. synapse_sdk-1.0.0a35.dist-info/RECORD +0 -137
  305. {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-2025.11.7.dist-info}/entry_points.txt +0 -0
  306. {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-2025.11.7.dist-info}/licenses/LICENSE +0 -0
  307. {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-2025.11.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,852 @@
1
+ ---
2
+ id: plugins
3
+ title: Plugin System
4
+ sidebar_position: 1
5
+ ---
6
+
7
+ # Plugin System
8
+
9
+ The Synapse SDK provides a comprehensive plugin system for building and managing ML plugins across different categories and execution methods. The plugin system enables modular, reusable components that can be distributed and executed in various environments.
10
+
11
+ ## Overview
12
+
13
+ The plugin system is built around the concept of **actions** - discrete operations that can be packaged, distributed, and executed in different contexts. Each plugin belongs to a specific category and can support multiple actions.
14
+
15
+ ### Key Features
16
+
17
+ - **🔌 Modular Architecture**: Plugins are self-contained with their own dependencies and configuration
18
+ - **⚡ Multiple Execution Methods**: Support for Jobs, Tasks, and REST API endpoints
19
+ - **📦 Distributed Execution**: Built for scalable, distributed computing
20
+ - **🛠️ Template System**: Cookiecutter-based scaffolding for rapid plugin development
21
+ - **📊 Progress Tracking**: Built-in logging, metrics, and progress monitoring
22
+ - **🔄 Dynamic Loading**: Runtime plugin discovery and registration
23
+
24
+ ## Plugin Categories
25
+
26
+ The SDK organizes plugins into specific categories, each designed for different aspects of ML workflows:
27
+
28
+ ### 1. Neural Networks (`neural_net`)
29
+
30
+ ML model training, inference, and deployment operations.
31
+
32
+ **Available Actions:**
33
+
34
+ - `deployment` - Deploy models to production environments
35
+ - `gradio` - Create interactive web interfaces for models
36
+ - `inference` - Run model predictions on data
37
+ - `test` - Validate model performance and accuracy
38
+ - `train` - Train ML models with custom datasets
39
+ - `tune` - Hyperparameter optimization and model tuning
40
+
41
+ **Use Cases:**
42
+
43
+ - Training computer vision models
44
+ - Deploying models as web services
45
+ - Running batch inference on datasets
46
+ - Creating interactive model demos
47
+
48
+ ### 2. Export (`export`)
49
+
50
+ Data export and transformation operations for exporting annotated data, ground truth datasets, assignments, and tasks from the Synapse platform.
51
+
52
+ **Available Actions:**
53
+
54
+ - `export` - Export data from various sources (assignments, ground truth, tasks) with customizable processing
55
+
56
+ **Use Cases:**
57
+
58
+ - Exporting annotated datasets for training
59
+ - Converting ground truth data to custom formats
60
+ - Creating data packages for distribution
61
+ - Batch processing of assignment results
62
+ - Transforming annotation data for external tools
63
+
64
+ **Supported Export Targets:**
65
+
66
+ - `assignment` - Export assignment data with annotations
67
+ - `ground_truth` - Export ground truth dataset versions
68
+ - `task` - Export task data with associated annotations
69
+
70
+ For detailed information about export plugins, BaseExporter class architecture, implementation examples, and best practices, see the [Export Plugins](./export-plugins) documentation.
71
+
72
+ ### 3. Upload (`upload`)
73
+
74
+ File and data upload functionality with support for various storage backends and flexible asset path configuration.
75
+
76
+ **Available Actions:**
77
+
78
+ - `upload` - Upload files to storage providers with multi-path mode support
79
+
80
+ **Use Cases:**
81
+
82
+ - Uploading datasets from multiple locations with individual path settings
83
+ - Organizing complex multi-asset datasets with per-asset recursive discovery
84
+ - Processing datasets with Excel metadata integration
85
+ - Handling large-scale uploads with batch processing and progress tracking
86
+
87
+ **📖 Upload Plugin Documentation:**
88
+
89
+ - **[Upload Plugin Overview](./categories/upload-plugins/upload-plugin-overview.md)** - User guide with configuration examples and usage
90
+ - **[BaseUploader Template Guide](./categories/upload-plugins/upload-plugin-template.md)** - Plugin development guide using BaseUploader template
91
+ - **[Upload Action Development](./categories/upload-plugins/upload-plugin-action.md)** - SDK developer guide for action architecture and internals
92
+
93
+ ### 4. Smart Tools (`smart_tool`)
94
+
95
+ Intelligent automation tools powered by AI.
96
+
97
+ **Available Actions:**
98
+
99
+ - `auto_label` - Automated data labeling and annotation
100
+
101
+ **Use Cases:**
102
+
103
+ - Pre-labeling datasets with AI models
104
+ - Quality assurance for manual annotations
105
+ - Accelerating annotation workflows
106
+
107
+ ### 5. Pre-annotation (`pre_annotation`)
108
+
109
+ Data preparation and processing before annotation.
110
+
111
+ **Available Actions:**
112
+
113
+ - `pre_annotation` - Prepare data for annotation workflows
114
+ - `to_task` - Convert data to annotation tasks
115
+
116
+ **Use Cases:**
117
+
118
+ - Data preprocessing and filtering
119
+ - Creating annotation tasks from raw data
120
+ - Setting up annotation workflows
121
+
122
+ ### 6. Post-annotation (`post_annotation`)
123
+
124
+ Data processing and validation after annotation.
125
+
126
+ **Available Actions:**
127
+
128
+ - `post_annotation` - Process completed annotations
129
+
130
+ **Use Cases:**
131
+
132
+ - Validating annotation quality
133
+ - Post-processing annotated data
134
+ - Generating training datasets from annotations
135
+
136
+ ### 7. Data Validation (`data_validation`)
137
+
138
+ Data quality checks and validation operations.
139
+
140
+ **Available Actions:**
141
+
142
+ - `validation` - Perform data quality and integrity checks
143
+
144
+ **Use Cases:**
145
+
146
+ - Validating dataset integrity
147
+ - Checking annotation consistency
148
+ - Quality assurance workflows
149
+
150
+ ## Execution Methods
151
+
152
+ Plugins support three different execution methods depending on the use case:
153
+
154
+ ### Job Execution
155
+
156
+ **Job-based execution** for long-running, distributed processing tasks.
157
+
158
+ - Best for: Training models, processing large datasets
159
+ - Features: Distributed execution, resource management, fault tolerance
160
+ - Monitoring: Full job lifecycle tracking and logging
161
+
162
+ ### Task Execution
163
+
164
+ **Task-based execution** for simple, short-running operations.
165
+
166
+ - Best for: Quick data processing, validation checks
167
+ - Features: Lightweight execution, fast startup
168
+ - Monitoring: Basic progress tracking
169
+
170
+ ### REST API Execution
171
+
172
+ **Serve-based execution** for web API endpoints.
173
+
174
+ - Best for: Real-time inference, interactive applications
175
+ - Features: HTTP endpoints, auto-scaling, load balancing
176
+ - Monitoring: Request/response logging, performance metrics
177
+
178
+ ## Plugin Architecture
179
+
180
+ ### Core Components
181
+
182
+ #### Plugin Models
183
+
184
+ **PluginRelease Class** (`synapse_sdk/plugins/models.py:14`)
185
+
186
+ - Manages plugin metadata and configuration
187
+ - Handles versioning and checksums
188
+ - Provides runtime environment setup
189
+
190
+ **Run Class** (`synapse_sdk/plugins/models.py:98`)
191
+
192
+ - Manages plugin execution instances
193
+ - Provides logging and progress tracking
194
+ - Handles backend communication
195
+
196
+ #### Action Base Class
197
+
198
+ **Action Class** (`synapse_sdk/plugins/categories/base.py:19`)
199
+
200
+ - Unified interface for all plugin actions
201
+ - Parameter validation with Pydantic models
202
+ - Built-in logging and error handling
203
+ - Runtime environment management
204
+
205
+ #### Template System
206
+
207
+ **Cookiecutter Templates** (`synapse_sdk/plugins/templates/`)
208
+
209
+ - Standardized plugin scaffolding
210
+ - Category-specific templates
211
+ - Automated project setup with proper structure
212
+
213
+ ### Plugin Structure
214
+
215
+ Each plugin follows a standardized structure:
216
+
217
+ ```
218
+ synapse-{plugin-code}-plugin/
219
+ ├── config.yaml # Plugin metadata and configuration
220
+ ├── plugin/ # Source code directory
221
+ │ ├── __init__.py
222
+ │ ├── {action1}.py # Action implementations
223
+ │ └── {action2}.py
224
+ ├── requirements.txt # Python dependencies
225
+ ├── pyproject.toml # Package configuration
226
+ └── README.md # Plugin documentation
227
+ ```
228
+
229
+ ### Configuration File (`config.yaml`)
230
+
231
+ ```yaml
232
+ # Plugin metadata
233
+ code: "my-plugin"
234
+ name: "My Custom Plugin"
235
+ version: "1.0.0"
236
+ category: "neural_net"
237
+ description: "A custom ML plugin"
238
+
239
+ # Package management
240
+ package_manager: "pip" # or "uv"
241
+
242
+ # Package manager options (optional)
243
+ # For uv: defaults to ['--no-cache']
244
+ # For pip: defaults to ['--upgrade'] to ensure requirements.txt versions override pre-installed packages
245
+ package_manager_options: ["--no-cache", "--quiet"]
246
+
247
+ # Action definitions
248
+ actions:
249
+ train:
250
+ entrypoint: "plugin.train.TrainAction"
251
+ method: "job"
252
+ inference:
253
+ entrypoint: "plugin.inference.InferenceAction"
254
+ method: "restapi"
255
+ ```
256
+
257
+ ## Creating Plugins
258
+
259
+ ### 1. Generate Plugin Template
260
+
261
+ Use the CLI to create a new plugin from templates:
262
+
263
+ ```bash
264
+ synapse plugin create
265
+ ```
266
+
267
+ This will prompt for:
268
+
269
+ - Plugin code (unique identifier)
270
+ - Plugin name and description
271
+ - Category selection
272
+ - Required actions
273
+
274
+ ### 2. Implement Actions
275
+
276
+ Each action inherits from the base `Action` class:
277
+
278
+ ```python
279
+ # plugin/train.py
280
+ from synapse_sdk.plugins.categories.neural_net import TrainAction as BaseTrainAction
281
+ from pydantic import BaseModel
282
+
283
+ class TrainParams(BaseModel):
284
+ dataset_path: str
285
+ epochs: int = 10
286
+ learning_rate: float = 0.001
287
+
288
+ class TrainAction(BaseTrainAction):
289
+ name = "train"
290
+ params_model = TrainParams
291
+
292
+ def start(self):
293
+ # Access validated parameters
294
+ dataset_path = self.params['dataset_path']
295
+ epochs = self.params['epochs']
296
+
297
+ # Log progress
298
+ self.run.log_message("Starting training...")
299
+
300
+ # Your training logic here
301
+ for epoch in range(epochs):
302
+ # Update progress
303
+ self.run.set_progress(epoch + 1, epochs, "training")
304
+
305
+ # Training step
306
+ loss = train_epoch(dataset_path)
307
+
308
+ # Log metrics
309
+ self.run.set_metrics({"loss": loss}, "training")
310
+
311
+ self.run.log_message("Training completed!")
312
+ return {"status": "success", "final_loss": loss}
313
+ ```
314
+
315
+ #### Creating Export Plugins
316
+
317
+ Export plugins now use the BaseExporter class-based approach for better organization and reusability. Here's how to create a custom export plugin:
318
+
319
+ **Step 1: Generate Export Plugin Template**
320
+
321
+ ```bash
322
+ synapse plugin create
323
+ # Select 'export' as category
324
+ # Plugin will be created with export template
325
+ ```
326
+
327
+ **Step 2: Customize Export Parameters**
328
+
329
+ The `ExportParams` model defines the required parameters:
330
+
331
+ ```python
332
+ from synapse_sdk.plugins.categories.export.actions.export import ExportParams
333
+ from pydantic import BaseModel
334
+ from typing import Literal
335
+
336
+ class CustomExportParams(ExportParams):
337
+ # Add custom parameters
338
+ output_format: Literal['json', 'csv', 'xml'] = 'json'
339
+ include_metadata: bool = True
340
+ compression: bool = False
341
+ ```
342
+
343
+ **Step 3: Implement Data Transformation**
344
+
345
+ Implement the required methods in your `Exporter` class in `plugin/export.py`:
346
+
347
+ ```python
348
+ from datetime import datetime
349
+ from synapse_sdk.plugins.categories.export.templates.plugin import BaseExporter
350
+
351
+ class Exporter(BaseExporter):
352
+ """Custom export plugin with COCO format conversion."""
353
+
354
+ def convert_data(self, data):
355
+ """Convert annotation data to your desired format."""
356
+ # Example: Convert to COCO format
357
+ if data.get('data_type') == 'image_detection':
358
+ return self.convert_to_coco_format(data)
359
+ elif data.get('data_type') == 'image_classification':
360
+ return self.convert_to_classification_format(data)
361
+ return data
362
+
363
+ def before_convert(self, export_item):
364
+ """Preprocess data before conversion."""
365
+ # Add validation, filtering, or preprocessing
366
+ if not export_item.get('data'):
367
+ return None # Skip empty items
368
+
369
+ # Add custom metadata
370
+ export_item['processed_at'] = datetime.now().isoformat()
371
+ return export_item
372
+
373
+ def after_convert(self, converted_data):
374
+ """Post-process converted data."""
375
+ # Add final touches, validation, or formatting
376
+ if 'annotations' in converted_data:
377
+ converted_data['annotation_count'] = len(converted_data['annotations'])
378
+ return converted_data
379
+
380
+ def convert_to_coco_format(self, data):
381
+ """Example: Convert to COCO detection format."""
382
+ coco_data = {
383
+ "images": [],
384
+ "annotations": [],
385
+ "categories": []
386
+ }
387
+
388
+ # Transform annotation data to COCO format
389
+ for annotation in data.get('annotations', []):
390
+ coco_annotation = {
391
+ "id": annotation['id'],
392
+ "image_id": annotation['image_id'],
393
+ "category_id": annotation['category_id'],
394
+ "bbox": annotation['bbox'],
395
+ "area": annotation.get('area', 0),
396
+ "iscrowd": 0
397
+ }
398
+ coco_data["annotations"].append(coco_annotation)
399
+
400
+ return coco_data
401
+ ```
402
+
403
+ **Step 4: Configure Export Targets**
404
+
405
+ The export action supports different data sources:
406
+
407
+ ```python
408
+ # Filter examples for different targets
409
+ filters = {
410
+ # For ground truth export
411
+ "ground_truth": {
412
+ "ground_truth_dataset_version": 123,
413
+ "expand": ["data"]
414
+ },
415
+
416
+ # For assignment export
417
+ "assignment": {
418
+ "project": 456,
419
+ "status": "completed",
420
+ "expand": ["data"]
421
+ },
422
+
423
+ # For task export
424
+ "task": {
425
+ "project": 456,
426
+ "assignment": 789,
427
+ "expand": ["data_unit", "assignment"]
428
+ }
429
+ }
430
+ ```
431
+
432
+ **Step 5: Handle File Operations**
433
+
434
+ Customize file saving and organization by overriding BaseExporter methods:
435
+
436
+ ```python
437
+ import json
438
+ from pathlib import Path
439
+ from synapse_sdk.plugins.categories.export.enums import ExportStatus
440
+
441
+ class Exporter(BaseExporter):
442
+ """Custom export plugin with multiple format support."""
443
+
444
+ def save_as_json(self, result, base_path, error_file_list):
445
+ """Custom JSON saving with different formats."""
446
+ file_name = Path(self.get_original_file_name(result['files'])).stem
447
+
448
+ # Choose output format based on params
449
+ if self.params.get('output_format') == 'csv':
450
+ return self.save_as_csv(result, base_path, error_file_list)
451
+ elif self.params.get('output_format') == 'xml':
452
+ return self.save_as_xml(result, base_path, error_file_list)
453
+
454
+ # Default JSON handling
455
+ json_data = result['data']
456
+ file_info = {'file_name': f'{file_name}.json'}
457
+
458
+ try:
459
+ with (base_path / f'{file_name}.json').open('w', encoding='utf-8') as f:
460
+ json.dump(json_data, f, indent=4, ensure_ascii=False)
461
+ status = ExportStatus.SUCCESS
462
+ except Exception as e:
463
+ error_file_list.append([f'{file_name}.json', str(e)])
464
+ status = ExportStatus.FAILED
465
+
466
+ self.run.export_log_json_file(result['id'], file_info, status)
467
+ return status
468
+
469
+ def setup_output_directories(self, unique_export_path, save_original_file_flag):
470
+ """Custom directory structure."""
471
+ # Create format-specific directories
472
+ output_paths = super().setup_output_directories(unique_export_path, save_original_file_flag)
473
+
474
+ # Add custom directories based on output format
475
+ format_dir = unique_export_path / self.params.get('output_format', 'json')
476
+ format_dir.mkdir(parents=True, exist_ok=True)
477
+ output_paths['format_output_path'] = format_dir
478
+
479
+ return output_paths
480
+ ```
481
+
482
+ **Step 6: Usage Examples**
483
+
484
+ Running export plugins with different configurations:
485
+
486
+ ```bash
487
+ # Basic export of ground truth data
488
+ synapse plugin run export '{
489
+ "name": "my_export",
490
+ "storage": 1,
491
+ "target": "ground_truth",
492
+ "filter": {"ground_truth_dataset_version": 123},
493
+ "path": "exports/ground_truth",
494
+ "save_original_file": true
495
+ }' --plugin my-export-plugin
496
+
497
+ # Export assignments with custom parameters
498
+ synapse plugin run export '{
499
+ "name": "assignment_export",
500
+ "storage": 1,
501
+ "target": "assignment",
502
+ "filter": {"project": 456, "status": "completed"},
503
+ "path": "exports/assignments",
504
+ "save_original_file": false,
505
+ "extra_params": {
506
+ "output_format": "coco",
507
+ "include_metadata": true
508
+ }
509
+ }' --plugin custom-coco-export
510
+ ```
511
+
512
+ **Common Export Patterns:**
513
+
514
+ ```python
515
+ # Pattern 1: Format-specific conversion
516
+ class Exporter(BaseExporter):
517
+ def convert_data(self, data):
518
+ """Convert to YOLO format."""
519
+ if data.get('task_type') == 'object_detection':
520
+ return self.convert_to_yolo_format(data)
521
+ return data
522
+
523
+ # Pattern 2: Conditional file organization
524
+ class Exporter(BaseExporter):
525
+ def setup_output_directories(self, unique_export_path, save_original_file_flag):
526
+ # Call parent method
527
+ output_paths = super().setup_output_directories(unique_export_path, save_original_file_flag)
528
+
529
+ # Create separate folders by category
530
+ for category in ['train', 'val', 'test']:
531
+ category_path = unique_export_path / category
532
+ category_path.mkdir(parents=True, exist_ok=True)
533
+ output_paths[f'{category}_path'] = category_path
534
+
535
+ return output_paths
536
+
537
+ # Pattern 3: Batch processing with validation
538
+ class Exporter(BaseExporter):
539
+ def before_convert(self, export_item):
540
+ # Validate required fields
541
+ required_fields = ['data', 'files', 'id']
542
+ for field in required_fields:
543
+ if field not in export_item:
544
+ raise ValueError(f"Missing required field: {field}")
545
+ return export_item
546
+ ```
547
+
548
+ ### 3. Configure Actions
549
+
550
+ Define actions in `config.yaml`:
551
+
552
+ ```yaml
553
+ actions:
554
+ train:
555
+ entrypoint: "plugin.train.TrainAction"
556
+ method: "job"
557
+ description: "Train a neural network model"
558
+
559
+ # Export plugin configuration
560
+ export:
561
+ entrypoint: "plugin.export.Exporter"
562
+ method: "job"
563
+ description: "Export and transform annotation data"
564
+ ```
565
+
566
+ ### 4. Package and Publish
567
+
568
+ ```bash
569
+ # Test locally
570
+ synapse plugin run train --debug
571
+
572
+ # Package for distribution
573
+ synapse plugin publish
574
+ ```
575
+
576
+ ## Running Plugins
577
+
578
+ ### Command Line Interface
579
+
580
+ ```bash
581
+ # Run a plugin action
582
+ synapse plugin run {action} {params}
583
+
584
+ # With specific plugin
585
+ synapse plugin run train '{"dataset_path": "/data/images", "epochs": 20}' --plugin my-plugin@1.0.0
586
+
587
+ # Debug mode (use local code)
588
+ synapse plugin run train '{"dataset_path": "/data/images"}' --debug
589
+
590
+ # Background job
591
+ synapse plugin run train '{"dataset_path": "/data/images"}' --job-id my-training-job
592
+ ```
593
+
594
+ ### Programmatic Usage
595
+
596
+ ```python
597
+ from synapse_sdk.plugins.utils import get_action_class
598
+
599
+ # Get action class by category and name
600
+ ActionClass = get_action_class("neural_net", "train")
601
+
602
+ # Create and run action
603
+ action = ActionClass(
604
+ params={"dataset_path": "/data/images", "epochs": 10},
605
+ plugin_config=plugin_config,
606
+ envs=env_vars
607
+ )
608
+
609
+ result = action.run_action()
610
+ ```
611
+
612
+ ## Development Workflow
613
+
614
+ ### 1. Local Development
615
+
616
+ ```bash
617
+ # Create plugin
618
+ synapse plugin create
619
+
620
+ # Develop and test locally
621
+ cd synapse-my-plugin-plugin
622
+ synapse plugin run action-name --debug
623
+
624
+ # Use development server for REST APIs
625
+ synapse plugin run serve --debug
626
+ ```
627
+
628
+ ### 2. Testing
629
+
630
+ ```bash
631
+ # Run plugin tests
632
+ pytest plugin/test_*.py
633
+
634
+ # Integration testing with distributed computing
635
+ synapse plugin run action-name --debug --job-id test-job
636
+ ```
637
+
638
+ ### 3. Deployment
639
+
640
+ ```bash
641
+ # Package plugin
642
+ synapse plugin publish
643
+
644
+ # Deploy to cluster
645
+ synapse plugin run action-name --job-id production-job
646
+ ```
647
+
648
+ ## Advanced Features
649
+
650
+ ### Custom Progress Categories
651
+
652
+ ```python
653
+ class MyAction(Action):
654
+ progress_categories = {
655
+ "preprocessing": "Data preprocessing",
656
+ "training": "Model training",
657
+ "validation": "Model validation"
658
+ }
659
+
660
+ def start(self):
661
+ # Update different progress categories
662
+ self.run.set_progress(50, 100, "preprocessing")
663
+ self.run.set_progress(10, 50, "training")
664
+ ```
665
+
666
+ ### Custom Metrics
667
+
668
+ ```python
669
+ def start(self):
670
+ # Log custom metrics
671
+ self.run.set_metrics({
672
+ "accuracy": 0.95,
673
+ "loss": 0.1,
674
+ "f1_score": 0.92
675
+ }, "validation")
676
+ ```
677
+
678
+ ### Runtime Environment Customization
679
+
680
+ ```python
681
+ def get_runtime_env(self):
682
+ env = super().get_runtime_env()
683
+
684
+ # Add custom environment variables
685
+ env['env_vars']['CUSTOM_VAR'] = 'value'
686
+
687
+ # Add additional packages
688
+ env['pip']['packages'].append('custom-package==1.0.0')
689
+
690
+ return env
691
+ ```
692
+
693
+ ### Parameter Validation
694
+
695
+ ```python
696
+ from pydantic import BaseModel, validator
697
+ from typing import Literal
698
+
699
+ class TrainParams(BaseModel):
700
+ model_type: Literal["cnn", "transformer", "resnet"]
701
+ dataset_path: str
702
+ batch_size: int = 32
703
+
704
+ @validator('batch_size')
705
+ def validate_batch_size(cls, v):
706
+ if v <= 0 or v > 512:
707
+ raise ValueError('Batch size must be between 1 and 512')
708
+ return v
709
+ ```
710
+
711
+ ## Best Practices
712
+
713
+ ### 1. Plugin Design
714
+
715
+ - **Single Responsibility**: Each action should have a clear, focused purpose
716
+ - **Parameterization**: Make actions configurable through parameters
717
+ - **Error Handling**: Implement robust error handling and validation
718
+ - **Documentation**: Provide clear documentation and examples
719
+
720
+ ### 2. Performance
721
+
722
+ - **Resource Management**: Use appropriate resource allocation for jobs
723
+ - **Progress Tracking**: Provide meaningful progress updates for long operations
724
+ - **Logging**: Log important events and errors for debugging
725
+ - **Memory Management**: Handle large datasets efficiently
726
+
727
+ ### 3. Testing
728
+
729
+ - **Unit Tests**: Test individual action logic
730
+ - **Integration Tests**: Test with distributed execution environment
731
+ - **Parameter Validation**: Test edge cases and error conditions
732
+ - **Performance Tests**: Validate execution time and resource usage
733
+
734
+ ### 4. Export Plugin Best Practices
735
+
736
+ #### Data Processing
737
+
738
+ - **Memory Efficiency**: Use generators for processing large datasets
739
+ - **Error Recovery**: Implement graceful error handling for individual items
740
+ - **Progress Reporting**: Update progress regularly for long-running exports
741
+ - **Data Validation**: Validate data structure before conversion
742
+
743
+ ```python
744
+ class Exporter(BaseExporter):
745
+ def export(self, export_items=None, results=None, **kwargs):
746
+ """Override the main export method for custom processing."""
747
+ # Use tee to count items without consuming generator
748
+ items_to_process = export_items if export_items is not None else self.export_items
749
+ export_items_count, export_items_process = tee(items_to_process)
750
+ total = sum(1 for _ in export_items_count)
751
+
752
+ # Custom processing with error handling
753
+ for no, export_item in enumerate(export_items_process, start=1):
754
+ try:
755
+ # Use the built-in data conversion pipeline
756
+ processed_item = self.process_data_conversion(export_item)
757
+ self.run.set_progress(no, total, category='dataset_conversion')
758
+ except Exception as e:
759
+ self.run.log_message(f"Error processing item {no}: {str(e)}", "ERROR")
760
+ continue
761
+
762
+ # Call parent's export method for standard processing
763
+ # or implement your own complete workflow
764
+ return super().export(export_items, results, **kwargs)
765
+ ```
766
+
767
+ #### File Management
768
+
769
+ - **Unique Paths**: Prevent file collisions with timestamp or counter suffixes
770
+ - **Directory Structure**: Organize output files logically
771
+ - **Error Logging**: Track failed files for debugging
772
+ - **Cleanup**: Remove temporary files on completion
773
+
774
+ ```python
775
+ class Exporter(BaseExporter):
776
+ def setup_output_directories(self, unique_export_path, save_original_file_flag):
777
+ """Create unique export directory structure."""
778
+ # BaseExporter already handles unique path creation via _create_unique_export_path
779
+ # This method sets up the internal directory structure
780
+ output_paths = super().setup_output_directories(unique_export_path, save_original_file_flag)
781
+
782
+ # Add custom subdirectories as needed
783
+ custom_dir = unique_export_path / 'custom_output'
784
+ custom_dir.mkdir(parents=True, exist_ok=True)
785
+ output_paths['custom_output_path'] = custom_dir
786
+
787
+ return output_paths
788
+ ```
789
+
790
+ #### Format Conversion
791
+
792
+ - **Flexible Templates**: Design templates that work with multiple data types
793
+ - **Schema Validation**: Validate output against expected schemas
794
+ - **Metadata Preservation**: Maintain important metadata during conversion
795
+ - **Version Compatibility**: Handle different data schema versions
796
+
797
+ ### 5. Security
798
+
799
+ - **Input Validation**: Validate all parameters and inputs
800
+ - **File Access**: Restrict file system access appropriately
801
+ - **Dependencies**: Keep dependencies updated and secure
802
+ - **Secrets**: Never log sensitive information
803
+
804
+ ## Monitoring and Debugging
805
+
806
+ ### Plugin Execution Logs
807
+
808
+ ```python
809
+ # In your action
810
+ self.run.log_message("Processing started", "INFO")
811
+ self.run.log_message("Warning: low memory", "WARNING")
812
+ self.run.log_message("Error occurred", "ERROR")
813
+
814
+ # With structured data
815
+ self.run.log("model_checkpoint", {
816
+ "epoch": 10,
817
+ "accuracy": 0.95,
818
+ "checkpoint_path": "/models/checkpoint_10.pth"
819
+ })
820
+ ```
821
+
822
+ ### Progress Monitoring
823
+
824
+ ```python
825
+ # Simple progress
826
+ self.run.set_progress(current=50, total=100)
827
+
828
+ # Categorized progress
829
+ self.run.set_progress(current=30, total=100, category="training")
830
+ self.run.set_progress(current=20, total=50, category="validation")
831
+ ```
832
+
833
+ ### Metrics Collection
834
+
835
+ ```python
836
+ # Training metrics
837
+ self.run.set_metrics({
838
+ "epoch": 10,
839
+ "train_loss": 0.1,
840
+ "train_accuracy": 0.95,
841
+ "learning_rate": 0.001
842
+ }, "training")
843
+
844
+ # Performance metrics
845
+ self.run.set_metrics({
846
+ "inference_time": 0.05,
847
+ "throughput": 200,
848
+ "memory_usage": 1024
849
+ }, "performance")
850
+ ```
851
+
852
+ The plugin system provides a powerful foundation for building scalable, distributed ML workflows. By following the established patterns and best practices, you can create robust plugins that integrate seamlessly with the Synapse ecosystem.