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.
- synapse_sdk/__init__.py +24 -0
- synapse_sdk/cli/__init__.py +308 -5
- synapse_sdk/cli/alias/utils.py +1 -1
- synapse_sdk/cli/code_server.py +687 -0
- synapse_sdk/cli/config.py +440 -0
- synapse_sdk/cli/devtools.py +90 -0
- synapse_sdk/cli/plugin/publish.py +23 -15
- synapse_sdk/clients/agent/__init__.py +9 -3
- synapse_sdk/clients/agent/container.py +133 -0
- synapse_sdk/clients/agent/core.py +19 -0
- synapse_sdk/clients/agent/ray.py +298 -9
- synapse_sdk/clients/backend/__init__.py +28 -12
- synapse_sdk/clients/backend/annotation.py +9 -1
- synapse_sdk/clients/backend/core.py +31 -4
- synapse_sdk/clients/backend/data_collection.py +186 -0
- synapse_sdk/clients/backend/hitl.py +1 -1
- synapse_sdk/clients/backend/integration.py +4 -3
- synapse_sdk/clients/backend/ml.py +1 -1
- synapse_sdk/clients/backend/models.py +35 -1
- synapse_sdk/clients/base.py +309 -36
- synapse_sdk/clients/ray/serve.py +2 -0
- synapse_sdk/devtools/__init__.py +0 -0
- synapse_sdk/devtools/config.py +94 -0
- synapse_sdk/devtools/docs/.gitignore +20 -0
- synapse_sdk/devtools/docs/README.md +41 -0
- synapse_sdk/devtools/docs/blog/2019-05-28-first-blog-post.md +12 -0
- synapse_sdk/devtools/docs/blog/2019-05-29-long-blog-post.md +44 -0
- synapse_sdk/devtools/docs/blog/2021-08-01-mdx-blog-post.mdx +24 -0
- synapse_sdk/devtools/docs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
- synapse_sdk/devtools/docs/blog/2021-08-26-welcome/index.md +29 -0
- synapse_sdk/devtools/docs/blog/authors.yml +25 -0
- synapse_sdk/devtools/docs/blog/tags.yml +19 -0
- synapse_sdk/devtools/docs/docs/api/clients/agent.md +43 -0
- synapse_sdk/devtools/docs/docs/api/clients/annotation-mixin.md +378 -0
- synapse_sdk/devtools/docs/docs/api/clients/backend.md +420 -0
- synapse_sdk/devtools/docs/docs/api/clients/base.md +257 -0
- synapse_sdk/devtools/docs/docs/api/clients/core-mixin.md +477 -0
- synapse_sdk/devtools/docs/docs/api/clients/data-collection-mixin.md +422 -0
- synapse_sdk/devtools/docs/docs/api/clients/hitl-mixin.md +554 -0
- synapse_sdk/devtools/docs/docs/api/clients/index.md +391 -0
- synapse_sdk/devtools/docs/docs/api/clients/integration-mixin.md +571 -0
- synapse_sdk/devtools/docs/docs/api/clients/ml-mixin.md +578 -0
- synapse_sdk/devtools/docs/docs/api/clients/ray.md +342 -0
- synapse_sdk/devtools/docs/docs/api/index.md +52 -0
- synapse_sdk/devtools/docs/docs/api/plugins/categories.md +43 -0
- synapse_sdk/devtools/docs/docs/api/plugins/models.md +114 -0
- synapse_sdk/devtools/docs/docs/api/plugins/utils.md +328 -0
- synapse_sdk/devtools/docs/docs/categories.md +0 -0
- synapse_sdk/devtools/docs/docs/cli-usage.md +280 -0
- synapse_sdk/devtools/docs/docs/concepts/index.md +38 -0
- synapse_sdk/devtools/docs/docs/configuration.md +83 -0
- synapse_sdk/devtools/docs/docs/contributing.md +306 -0
- synapse_sdk/devtools/docs/docs/examples/index.md +29 -0
- synapse_sdk/devtools/docs/docs/faq.md +179 -0
- synapse_sdk/devtools/docs/docs/features/converters/index.md +455 -0
- synapse_sdk/devtools/docs/docs/features/index.md +24 -0
- synapse_sdk/devtools/docs/docs/features/utils/file.md +415 -0
- synapse_sdk/devtools/docs/docs/features/utils/network.md +378 -0
- synapse_sdk/devtools/docs/docs/features/utils/storage.md +57 -0
- synapse_sdk/devtools/docs/docs/features/utils/types.md +51 -0
- synapse_sdk/devtools/docs/docs/installation.md +94 -0
- synapse_sdk/devtools/docs/docs/introduction.md +47 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/neural-net-plugins/train-action-overview.md +814 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-action.md +948 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-overview.md +544 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-template.md +766 -0
- synapse_sdk/devtools/docs/docs/plugins/export-plugins.md +1092 -0
- synapse_sdk/devtools/docs/docs/plugins/plugins.md +852 -0
- synapse_sdk/devtools/docs/docs/quickstart.md +78 -0
- synapse_sdk/devtools/docs/docs/troubleshooting.md +519 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/_category_.json +8 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/congratulations.md +23 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-blog-post.md +34 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-document.md +57 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-page.md +43 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/deploy-your-site.md +31 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/markdown-features.mdx +152 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/_category_.json +7 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/img/docsVersionDropdown.png +0 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/img/localeDropdown.png +0 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/manage-docs-versions.md +55 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/translate-your-site.md +88 -0
- synapse_sdk/devtools/docs/docusaurus.config.ts +148 -0
- synapse_sdk/devtools/docs/i18n/ko/code.json +325 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/agent.md +43 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/annotation-mixin.md +289 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/backend.md +420 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/base.md +257 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/core-mixin.md +417 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/data-collection-mixin.md +356 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/hitl-mixin.md +192 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/index.md +391 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/integration-mixin.md +479 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/ml-mixin.md +284 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/ray.md +342 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/index.md +52 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/plugins/models.md +114 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/categories.md +0 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/cli-usage.md +280 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/concepts/index.md +38 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/configuration.md +83 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/contributing.md +306 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/examples/index.md +29 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/faq.md +179 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/converters/index.md +30 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/index.md +24 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/file.md +415 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/network.md +378 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/storage.md +60 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/types.md +51 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/installation.md +94 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/introduction.md +47 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/neural-net-plugins/train-action-overview.md +815 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-action.md +948 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-overview.md +544 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-template.md +766 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/export-plugins.md +1092 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/plugins.md +117 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/quickstart.md +78 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/troubleshooting.md +519 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current.json +34 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-theme-classic/footer.json +42 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-theme-classic/navbar.json +18 -0
- synapse_sdk/devtools/docs/package-lock.json +18784 -0
- synapse_sdk/devtools/docs/package.json +48 -0
- synapse_sdk/devtools/docs/sidebars.ts +122 -0
- synapse_sdk/devtools/docs/src/components/HomepageFeatures/index.tsx +71 -0
- synapse_sdk/devtools/docs/src/components/HomepageFeatures/styles.module.css +11 -0
- synapse_sdk/devtools/docs/src/css/custom.css +30 -0
- synapse_sdk/devtools/docs/src/pages/index.module.css +23 -0
- synapse_sdk/devtools/docs/src/pages/index.tsx +21 -0
- synapse_sdk/devtools/docs/src/pages/markdown-page.md +7 -0
- synapse_sdk/devtools/docs/static/.nojekyll +0 -0
- synapse_sdk/devtools/docs/static/img/docusaurus-social-card.jpg +0 -0
- synapse_sdk/devtools/docs/static/img/docusaurus.png +0 -0
- synapse_sdk/devtools/docs/static/img/favicon.ico +0 -0
- synapse_sdk/devtools/docs/static/img/logo.png +0 -0
- synapse_sdk/devtools/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
- synapse_sdk/devtools/docs/static/img/undraw_docusaurus_react.svg +170 -0
- synapse_sdk/devtools/docs/static/img/undraw_docusaurus_tree.svg +40 -0
- synapse_sdk/devtools/docs/tsconfig.json +8 -0
- synapse_sdk/devtools/server.py +41 -0
- synapse_sdk/devtools/streamlit_app/__init__.py +5 -0
- synapse_sdk/devtools/streamlit_app/app.py +128 -0
- synapse_sdk/devtools/streamlit_app/services/__init__.py +11 -0
- synapse_sdk/devtools/streamlit_app/services/job_service.py +233 -0
- synapse_sdk/devtools/streamlit_app/services/plugin_service.py +236 -0
- synapse_sdk/devtools/streamlit_app/services/serve_service.py +95 -0
- synapse_sdk/devtools/streamlit_app/ui/__init__.py +15 -0
- synapse_sdk/devtools/streamlit_app/ui/config_tab.py +76 -0
- synapse_sdk/devtools/streamlit_app/ui/deployment_tab.py +66 -0
- synapse_sdk/devtools/streamlit_app/ui/http_tab.py +125 -0
- synapse_sdk/devtools/streamlit_app/ui/jobs_tab.py +573 -0
- synapse_sdk/devtools/streamlit_app/ui/serve_tab.py +346 -0
- synapse_sdk/devtools/streamlit_app/ui/status_bar.py +118 -0
- synapse_sdk/devtools/streamlit_app/utils/__init__.py +40 -0
- synapse_sdk/devtools/streamlit_app/utils/json_viewer.py +197 -0
- synapse_sdk/devtools/streamlit_app/utils/log_formatter.py +38 -0
- synapse_sdk/devtools/streamlit_app/utils/styles.py +241 -0
- synapse_sdk/devtools/streamlit_app/utils/ui_components.py +289 -0
- synapse_sdk/devtools/streamlit_app.py +10 -0
- synapse_sdk/loggers.py +65 -7
- synapse_sdk/plugins/README.md +1340 -0
- synapse_sdk/plugins/categories/base.py +73 -11
- synapse_sdk/plugins/categories/data_validation/actions/validation.py +72 -0
- synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py +33 -5
- synapse_sdk/plugins/categories/export/actions/__init__.py +3 -0
- synapse_sdk/plugins/categories/export/actions/export/__init__.py +28 -0
- synapse_sdk/plugins/categories/export/actions/export/action.py +165 -0
- synapse_sdk/plugins/categories/export/actions/export/enums.py +113 -0
- synapse_sdk/plugins/categories/export/actions/export/exceptions.py +53 -0
- synapse_sdk/plugins/categories/export/actions/export/models.py +74 -0
- synapse_sdk/plugins/categories/export/actions/export/run.py +195 -0
- synapse_sdk/plugins/categories/export/actions/{export.py → export/utils.py} +47 -82
- synapse_sdk/plugins/categories/export/templates/config.yaml +19 -1
- synapse_sdk/plugins/categories/export/templates/plugin/__init__.py +390 -0
- synapse_sdk/plugins/categories/export/templates/plugin/export.py +153 -129
- synapse_sdk/plugins/categories/neural_net/actions/deployment.py +9 -62
- synapse_sdk/plugins/categories/neural_net/actions/train.py +1062 -32
- synapse_sdk/plugins/categories/neural_net/actions/tune.py +534 -0
- synapse_sdk/plugins/categories/neural_net/templates/config.yaml +27 -5
- synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py +26 -10
- synapse_sdk/plugins/categories/pre_annotation/actions/__init__.py +4 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/__init__.py +3 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/action.py +10 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/__init__.py +28 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/action.py +145 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/enums.py +269 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/exceptions.py +14 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/factory.py +76 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/models.py +97 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/orchestrator.py +250 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/run.py +64 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/__init__.py +17 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/annotation.py +287 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/base.py +170 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/extraction.py +83 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/metrics.py +87 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/preprocessor.py +127 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/validation.py +143 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task.py +966 -0
- synapse_sdk/plugins/categories/pre_annotation/templates/config.yaml +19 -0
- synapse_sdk/plugins/categories/pre_annotation/templates/plugin/to_task.py +40 -0
- synapse_sdk/plugins/categories/upload/actions/upload/__init__.py +19 -0
- synapse_sdk/plugins/categories/upload/actions/upload/action.py +232 -0
- synapse_sdk/plugins/categories/upload/actions/upload/context.py +185 -0
- synapse_sdk/plugins/categories/upload/actions/upload/enums.py +471 -0
- synapse_sdk/plugins/categories/upload/actions/upload/exceptions.py +36 -0
- synapse_sdk/plugins/categories/upload/actions/upload/factory.py +138 -0
- synapse_sdk/plugins/categories/upload/actions/upload/models.py +203 -0
- synapse_sdk/plugins/categories/upload/actions/upload/orchestrator.py +183 -0
- synapse_sdk/plugins/categories/upload/actions/upload/registry.py +113 -0
- synapse_sdk/plugins/categories/upload/actions/upload/run.py +179 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/base.py +107 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/cleanup.py +62 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/collection.py +63 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/generate.py +84 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/initialize.py +82 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/metadata.py +235 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/organize.py +203 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/upload.py +97 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/validate.py +71 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/base.py +82 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/batch.py +39 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/single.py +29 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/flat.py +258 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/recursive.py +281 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/excel.py +174 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/none.py +16 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/sync.py +84 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/default.py +60 -0
- synapse_sdk/plugins/categories/upload/actions/upload/utils.py +250 -0
- synapse_sdk/plugins/categories/upload/templates/README.md +470 -0
- synapse_sdk/plugins/categories/upload/templates/config.yaml +29 -2
- synapse_sdk/plugins/categories/upload/templates/plugin/__init__.py +294 -0
- synapse_sdk/plugins/categories/upload/templates/plugin/upload.py +88 -30
- synapse_sdk/plugins/models.py +122 -16
- synapse_sdk/plugins/templates/plugin-config-schema.json +406 -0
- synapse_sdk/plugins/templates/schema.json +491 -0
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/requirements.txt +1 -1
- synapse_sdk/plugins/utils/__init__.py +46 -0
- synapse_sdk/plugins/utils/actions.py +119 -0
- synapse_sdk/plugins/utils/config.py +203 -0
- synapse_sdk/plugins/{utils.py → utils/legacy.py} +26 -46
- synapse_sdk/plugins/utils/ray_gcs.py +66 -0
- synapse_sdk/plugins/utils/registry.py +58 -0
- synapse_sdk/shared/__init__.py +25 -0
- synapse_sdk/shared/enums.py +93 -0
- synapse_sdk/utils/converters/__init__.py +240 -0
- synapse_sdk/utils/converters/coco/__init__.py +0 -0
- synapse_sdk/utils/converters/coco/from_dm.py +322 -0
- synapse_sdk/utils/converters/coco/to_dm.py +215 -0
- synapse_sdk/utils/converters/dm/__init__.py +56 -0
- synapse_sdk/utils/converters/dm/from_v1.py +627 -0
- synapse_sdk/utils/converters/dm/to_v1.py +367 -0
- synapse_sdk/utils/converters/pascal/__init__.py +0 -0
- synapse_sdk/utils/converters/pascal/from_dm.py +244 -0
- synapse_sdk/utils/converters/pascal/to_dm.py +214 -0
- synapse_sdk/utils/converters/yolo/__init__.py +0 -0
- synapse_sdk/utils/converters/yolo/from_dm.py +384 -0
- synapse_sdk/utils/converters/yolo/to_dm.py +267 -0
- synapse_sdk/utils/dataset.py +46 -0
- synapse_sdk/utils/encryption.py +158 -0
- synapse_sdk/utils/file/__init__.py +39 -0
- synapse_sdk/utils/file/archive.py +32 -0
- synapse_sdk/utils/file/checksum.py +56 -0
- synapse_sdk/utils/file/chunking.py +31 -0
- synapse_sdk/utils/file/download.py +385 -0
- synapse_sdk/utils/file/encoding.py +40 -0
- synapse_sdk/utils/file/io.py +22 -0
- synapse_sdk/utils/file/video/__init__.py +29 -0
- synapse_sdk/utils/file/video/transcode.py +307 -0
- synapse_sdk/utils/{file.py → file.py.backup} +84 -2
- synapse_sdk/utils/http.py +138 -0
- synapse_sdk/utils/network.py +293 -0
- synapse_sdk/utils/storage/__init__.py +36 -2
- synapse_sdk/utils/storage/providers/__init__.py +141 -0
- synapse_sdk/utils/storage/providers/file_system.py +134 -0
- synapse_sdk/utils/storage/providers/http.py +190 -0
- synapse_sdk/utils/storage/providers/s3.py +54 -6
- synapse_sdk/utils/storage/providers/sftp.py +31 -0
- synapse_sdk/utils/storage/registry.py +6 -0
- synapse_sdk-2025.11.7.dist-info/METADATA +122 -0
- synapse_sdk-2025.11.7.dist-info/RECORD +386 -0
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-2025.11.7.dist-info}/WHEEL +1 -1
- synapse_sdk/clients/backend/dataset.py +0 -102
- synapse_sdk/plugins/categories/upload/actions/upload.py +0 -293
- synapse_sdk-1.0.0a35.dist-info/METADATA +0 -47
- synapse_sdk-1.0.0a35.dist-info/RECORD +0 -137
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-2025.11.7.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-2025.11.7.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-2025.11.7.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"""Plugin configuration utilities."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any, Dict, List, Optional, Union
|
|
5
|
+
|
|
6
|
+
from synapse_sdk.utils.file import get_dict_from_file
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def read_plugin_config(plugin_path: Optional[Union[str, Path]] = None) -> Dict[str, Any]:
|
|
10
|
+
"""Read plugin configuration from config.yaml file.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
plugin_path: Path to plugin directory. If None, looks for config.yaml in current directory.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
Dict containing plugin configuration.
|
|
17
|
+
|
|
18
|
+
Raises:
|
|
19
|
+
FileNotFoundError: If config.yaml file is not found.
|
|
20
|
+
ValueError: If config.yaml is invalid.
|
|
21
|
+
"""
|
|
22
|
+
config_file_name = 'config.yaml'
|
|
23
|
+
if plugin_path:
|
|
24
|
+
config_path = Path(plugin_path) / config_file_name
|
|
25
|
+
else:
|
|
26
|
+
config_path = config_file_name
|
|
27
|
+
|
|
28
|
+
try:
|
|
29
|
+
return get_dict_from_file(config_path)
|
|
30
|
+
except FileNotFoundError:
|
|
31
|
+
raise FileNotFoundError(f'Plugin config file not found: {config_path}')
|
|
32
|
+
except Exception as e:
|
|
33
|
+
raise ValueError(f'Invalid plugin config file: {e}')
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def get_plugin_actions(
|
|
37
|
+
config: Optional[Dict[str, Any]] = None, plugin_path: Optional[Union[str, Path]] = None
|
|
38
|
+
) -> List[str]:
|
|
39
|
+
"""Get list of action names from plugin configuration.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
config: Plugin configuration dictionary. If None, reads from plugin_path.
|
|
43
|
+
plugin_path: Path to plugin directory. Used if config is None.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
List of action names defined in the plugin.
|
|
47
|
+
|
|
48
|
+
Raises:
|
|
49
|
+
ValueError: If neither config nor plugin_path is provided.
|
|
50
|
+
KeyError: If 'actions' key is missing from config.
|
|
51
|
+
|
|
52
|
+
Examples:
|
|
53
|
+
>>> get_plugin_actions(plugin_path="./my-plugin")
|
|
54
|
+
['train', 'inference', 'test']
|
|
55
|
+
|
|
56
|
+
>>> config = {'actions': {'train': {...}, 'test': {...}}}
|
|
57
|
+
>>> get_plugin_actions(config=config)
|
|
58
|
+
['train', 'test']
|
|
59
|
+
"""
|
|
60
|
+
if config is None:
|
|
61
|
+
if plugin_path is None:
|
|
62
|
+
raise ValueError('Either config or plugin_path must be provided')
|
|
63
|
+
config = read_plugin_config(plugin_path)
|
|
64
|
+
|
|
65
|
+
if 'actions' not in config:
|
|
66
|
+
raise KeyError("'actions' key not found in plugin configuration")
|
|
67
|
+
|
|
68
|
+
actions = config['actions']
|
|
69
|
+
if not isinstance(actions, dict):
|
|
70
|
+
raise ValueError("'actions' must be a dictionary")
|
|
71
|
+
|
|
72
|
+
return list(actions.keys())
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def get_action_config(
|
|
76
|
+
action_name: str, config: Optional[Dict[str, Any]] = None, plugin_path: Optional[Union[str, Path]] = None
|
|
77
|
+
) -> Dict[str, Any]:
|
|
78
|
+
"""Get configuration for a specific action.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
action_name: Name of the action to get config for.
|
|
82
|
+
config: Plugin configuration dictionary. If None, reads from plugin_path.
|
|
83
|
+
plugin_path: Path to plugin directory. Used if config is None.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
Dictionary containing action configuration.
|
|
87
|
+
|
|
88
|
+
Raises:
|
|
89
|
+
ValueError: If neither config nor plugin_path is provided.
|
|
90
|
+
KeyError: If action is not found in plugin configuration.
|
|
91
|
+
|
|
92
|
+
Examples:
|
|
93
|
+
>>> get_action_config('train', plugin_path="./my-plugin")
|
|
94
|
+
{'entrypoint': 'plugin.train.TrainAction', 'method': 'job'}
|
|
95
|
+
"""
|
|
96
|
+
if config is None:
|
|
97
|
+
if plugin_path is None:
|
|
98
|
+
raise ValueError('Either config or plugin_path must be provided')
|
|
99
|
+
config = read_plugin_config(plugin_path)
|
|
100
|
+
|
|
101
|
+
if 'actions' not in config:
|
|
102
|
+
raise KeyError("'actions' key not found in plugin configuration")
|
|
103
|
+
|
|
104
|
+
actions = config['actions']
|
|
105
|
+
if action_name not in actions:
|
|
106
|
+
available_actions = list(actions.keys())
|
|
107
|
+
raise KeyError(f"Action '{action_name}' not found. Available actions: {available_actions}")
|
|
108
|
+
|
|
109
|
+
return actions[action_name]
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def validate_plugin_config(config: Dict[str, Any]) -> bool:
|
|
113
|
+
"""Validate plugin configuration structure.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
config: Plugin configuration dictionary to validate.
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
True if configuration is valid.
|
|
120
|
+
|
|
121
|
+
Raises:
|
|
122
|
+
ValueError: If configuration is invalid with detailed error message.
|
|
123
|
+
|
|
124
|
+
Examples:
|
|
125
|
+
>>> config = {
|
|
126
|
+
... 'name': 'My Plugin',
|
|
127
|
+
... 'code': 'my-plugin',
|
|
128
|
+
... 'version': '1.0.0',
|
|
129
|
+
... 'category': 'neural_net',
|
|
130
|
+
... 'actions': {'train': {'entrypoint': 'plugin.train.TrainAction'}}
|
|
131
|
+
... }
|
|
132
|
+
>>> validate_plugin_config(config)
|
|
133
|
+
True
|
|
134
|
+
"""
|
|
135
|
+
required_fields = ['name', 'code', 'version', 'category', 'actions']
|
|
136
|
+
|
|
137
|
+
# Check required fields
|
|
138
|
+
for field in required_fields:
|
|
139
|
+
if field not in config:
|
|
140
|
+
raise ValueError(f"Required field '{field}' missing from plugin configuration")
|
|
141
|
+
|
|
142
|
+
# Validate actions structure
|
|
143
|
+
actions = config['actions']
|
|
144
|
+
if not isinstance(actions, dict):
|
|
145
|
+
raise ValueError("'actions' must be a dictionary")
|
|
146
|
+
|
|
147
|
+
if not actions:
|
|
148
|
+
raise ValueError('Plugin must define at least one action')
|
|
149
|
+
|
|
150
|
+
# Validate each action
|
|
151
|
+
for action_name, action_config in actions.items():
|
|
152
|
+
if not isinstance(action_config, dict):
|
|
153
|
+
raise ValueError(f"Action '{action_name}' configuration must be a dictionary")
|
|
154
|
+
|
|
155
|
+
# Check for entrypoint (required for most actions)
|
|
156
|
+
if 'entrypoint' not in action_config and action_config.get('method') != 'restapi':
|
|
157
|
+
raise ValueError(f"Action '{action_name}' missing required 'entrypoint' field")
|
|
158
|
+
|
|
159
|
+
# Validate category
|
|
160
|
+
from synapse_sdk.plugins.enums import PluginCategory
|
|
161
|
+
|
|
162
|
+
valid_categories = [cat.value for cat in PluginCategory]
|
|
163
|
+
if config['category'] not in valid_categories:
|
|
164
|
+
raise ValueError(f"Invalid category '{config['category']}'. Must be one of: {valid_categories}")
|
|
165
|
+
|
|
166
|
+
return True
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def get_plugin_metadata(
|
|
170
|
+
config: Optional[Dict[str, Any]] = None, plugin_path: Optional[Union[str, Path]] = None
|
|
171
|
+
) -> Dict[str, Any]:
|
|
172
|
+
"""Get plugin metadata (name, version, description, etc.).
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
config: Plugin configuration dictionary. If None, reads from plugin_path.
|
|
176
|
+
plugin_path: Path to plugin directory. Used if config is None.
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
Dictionary containing plugin metadata.
|
|
180
|
+
|
|
181
|
+
Examples:
|
|
182
|
+
>>> get_plugin_metadata(plugin_path="./my-plugin")
|
|
183
|
+
{
|
|
184
|
+
'name': 'My Plugin',
|
|
185
|
+
'code': 'my-plugin',
|
|
186
|
+
'version': '1.0.0',
|
|
187
|
+
'category': 'neural_net',
|
|
188
|
+
'description': 'A custom ML plugin'
|
|
189
|
+
}
|
|
190
|
+
"""
|
|
191
|
+
if config is None:
|
|
192
|
+
if plugin_path is None:
|
|
193
|
+
raise ValueError('Either config or plugin_path must be provided')
|
|
194
|
+
config = read_plugin_config(plugin_path)
|
|
195
|
+
|
|
196
|
+
metadata_fields = ['name', 'code', 'version', 'category', 'description']
|
|
197
|
+
metadata = {}
|
|
198
|
+
|
|
199
|
+
for field in metadata_fields:
|
|
200
|
+
if field in config:
|
|
201
|
+
metadata[field] = config[field]
|
|
202
|
+
|
|
203
|
+
return metadata
|
|
@@ -1,58 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
"""Legacy utility functions for backward compatibility."""
|
|
2
|
+
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
|
|
4
5
|
from synapse_sdk.i18n import gettext as _
|
|
5
|
-
from synapse_sdk.plugins.categories.registry import _REGISTERED_ACTIONS, register_actions
|
|
6
|
-
from synapse_sdk.plugins.enums import PluginCategory
|
|
7
6
|
from synapse_sdk.plugins.exceptions import ActionError
|
|
8
|
-
from synapse_sdk.utils.file import get_dict_from_file
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def get_action(action, params_data, *args, **kwargs):
|
|
12
|
-
if isinstance(params_data, str):
|
|
13
|
-
try:
|
|
14
|
-
params = json.loads(params_data)
|
|
15
|
-
except json.JSONDecodeError:
|
|
16
|
-
params = get_dict_from_file(params_data)
|
|
17
|
-
else:
|
|
18
|
-
params = params_data
|
|
19
|
-
|
|
20
|
-
config_data = kwargs.pop('config', False)
|
|
21
|
-
if config_data:
|
|
22
|
-
if isinstance(config_data, str):
|
|
23
|
-
config = read_plugin_config(plugin_path=config_data)
|
|
24
|
-
else:
|
|
25
|
-
config = config_data
|
|
26
|
-
else:
|
|
27
|
-
config = read_plugin_config()
|
|
28
|
-
category = config['category']
|
|
29
|
-
return get_action_class(category, action)(params, config, *args, **kwargs)
|
|
30
|
-
|
|
31
7
|
|
|
32
|
-
|
|
33
|
-
register_actions()
|
|
34
|
-
return _REGISTERED_ACTIONS[category][action]
|
|
8
|
+
from .actions import get_action
|
|
35
9
|
|
|
36
10
|
|
|
37
|
-
def
|
|
38
|
-
|
|
39
|
-
return list(_REGISTERED_ACTIONS[category].keys())
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def get_plugin_categories():
|
|
43
|
-
return [plugin_category.value for plugin_category in PluginCategory]
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def read_plugin_config(plugin_path=None):
|
|
47
|
-
config_file_name = 'config.yaml'
|
|
48
|
-
if plugin_path:
|
|
49
|
-
config_path = Path(plugin_path) / config_file_name
|
|
50
|
-
else:
|
|
51
|
-
config_path = config_file_name
|
|
52
|
-
return get_dict_from_file(config_path)
|
|
11
|
+
def read_requirements(file_path):
|
|
12
|
+
"""Read and parse a requirements.txt file.
|
|
53
13
|
|
|
14
|
+
Args:
|
|
15
|
+
file_path: Path to the requirements.txt file
|
|
54
16
|
|
|
55
|
-
|
|
17
|
+
Returns:
|
|
18
|
+
List of requirement strings, or None if file doesn't exist
|
|
19
|
+
"""
|
|
56
20
|
file_path = Path(file_path)
|
|
57
21
|
if not file_path.exists():
|
|
58
22
|
return None
|
|
@@ -76,6 +40,22 @@ def run_plugin(
|
|
|
76
40
|
debug=False,
|
|
77
41
|
**kwargs,
|
|
78
42
|
):
|
|
43
|
+
"""Execute a plugin action with the specified parameters.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
action: The action name to execute
|
|
47
|
+
params: Parameters for the action
|
|
48
|
+
plugin_config: Plugin configuration dictionary
|
|
49
|
+
plugin_path: Path to the plugin directory
|
|
50
|
+
modules: List of modules for debugging
|
|
51
|
+
requirements: List of requirements
|
|
52
|
+
envs: Environment variables dictionary
|
|
53
|
+
debug: Whether to run in debug mode
|
|
54
|
+
**kwargs: Additional keyword arguments
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
Result of the action execution
|
|
58
|
+
"""
|
|
79
59
|
from synapse_sdk.plugins.models import PluginRelease
|
|
80
60
|
|
|
81
61
|
if not envs:
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Utilities for converting HTTP URLs to Ray GCS URLs."""
|
|
2
|
+
|
|
3
|
+
import tempfile
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def convert_http_to_ray_gcs(http_url: str) -> str:
|
|
8
|
+
"""Convert HTTP URL to Ray GCS URL by downloading and uploading to Ray's GCS.
|
|
9
|
+
|
|
10
|
+
Ray's working_dir only accepts certain protocols (gcs://, s3://, gs://, https://).
|
|
11
|
+
When SYNAPSE_PLUGIN_STORAGE is an HTTP URL (Django media server), this function
|
|
12
|
+
converts it to a Ray-compatible gcs:// URL by:
|
|
13
|
+
1. Downloading the file from HTTP
|
|
14
|
+
2. Uploading it to Ray's Global Control Store (GCS)
|
|
15
|
+
3. Returning the content-addressable gcs:// URI
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
http_url: HTTP/HTTPS URL to plugin zip file
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
gcs:// URL that Ray can use for working_dir
|
|
22
|
+
Example: "gcs://_ray_pkg_abc123def456.zip"
|
|
23
|
+
|
|
24
|
+
Raises:
|
|
25
|
+
RuntimeError: If Ray is not initialized or not installed
|
|
26
|
+
requests.exceptions.RequestException: If HTTP download fails
|
|
27
|
+
|
|
28
|
+
Note:
|
|
29
|
+
- Ray must be initialized (ray.init()) before calling this function
|
|
30
|
+
- The gcs:// URI is content-addressable (same file = same URI)
|
|
31
|
+
- Ray automatically deduplicates uploads via package_exists()
|
|
32
|
+
"""
|
|
33
|
+
try:
|
|
34
|
+
import ray
|
|
35
|
+
except ImportError:
|
|
36
|
+
raise RuntimeError(
|
|
37
|
+
'Ray is not installed but is required for HTTP → GCS conversion. Install ray with: pip install ray'
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
if not ray.is_initialized():
|
|
41
|
+
raise RuntimeError(
|
|
42
|
+
'Ray must be initialized before converting HTTP URLs to GCS. '
|
|
43
|
+
'Call ray.init() before submitting jobs with HTTP storage.'
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
from ray._private.runtime_env.packaging import (
|
|
47
|
+
get_uri_for_package,
|
|
48
|
+
package_exists,
|
|
49
|
+
upload_package_to_gcs,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
from synapse_sdk.plugins.upload import download_file
|
|
53
|
+
|
|
54
|
+
# Download HTTP file to temporary location
|
|
55
|
+
with tempfile.TemporaryDirectory() as temp_dir:
|
|
56
|
+
local_path = Path(download_file(http_url, temp_dir))
|
|
57
|
+
|
|
58
|
+
# Generate content-addressable gcs:// URI based on file content
|
|
59
|
+
gcs_uri = get_uri_for_package(local_path)
|
|
60
|
+
|
|
61
|
+
# Check if already exists in Ray GCS (deduplication)
|
|
62
|
+
if not package_exists(gcs_uri):
|
|
63
|
+
# Upload to Ray's Global Control Store
|
|
64
|
+
upload_package_to_gcs(gcs_uri, local_path.read_bytes())
|
|
65
|
+
|
|
66
|
+
return gcs_uri
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Plugin registry utilities."""
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from synapse_sdk.plugins.enums import PluginCategory
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_plugin_categories() -> List[str]:
|
|
9
|
+
"""Get list of all available plugin categories.
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
List of plugin category names.
|
|
13
|
+
|
|
14
|
+
Examples:
|
|
15
|
+
>>> get_plugin_categories()
|
|
16
|
+
['neural_net', 'export', 'upload', 'smart_tool', 'post_annotation', 'pre_annotation', 'data_validation']
|
|
17
|
+
"""
|
|
18
|
+
return [plugin_category.value for plugin_category in PluginCategory]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def is_valid_category(category: str) -> bool:
|
|
22
|
+
"""Check if a category is valid.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
category: Category name to validate.
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
True if category is valid, False otherwise.
|
|
29
|
+
|
|
30
|
+
Examples:
|
|
31
|
+
>>> is_valid_category('neural_net')
|
|
32
|
+
True
|
|
33
|
+
>>> is_valid_category('invalid_category')
|
|
34
|
+
False
|
|
35
|
+
"""
|
|
36
|
+
return category in get_plugin_categories()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def get_category_display_name(category: str) -> str:
|
|
40
|
+
"""Get human-readable display name for a category.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
category: Category name.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
Human-readable category name.
|
|
47
|
+
|
|
48
|
+
Examples:
|
|
49
|
+
>>> get_category_display_name('neural_net')
|
|
50
|
+
'Neural Net'
|
|
51
|
+
>>> get_category_display_name('data_validation')
|
|
52
|
+
'Data Validation'
|
|
53
|
+
"""
|
|
54
|
+
try:
|
|
55
|
+
plugin_category = PluginCategory(category)
|
|
56
|
+
return plugin_category.name.replace('_', ' ').title()
|
|
57
|
+
except ValueError:
|
|
58
|
+
return category.replace('_', ' ').title()
|
synapse_sdk/shared/__init__.py
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def needs_sentry_init():
|
|
5
|
+
return os.getenv('SENTRY_DSN') is not None
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def init_sentry():
|
|
9
|
+
import sentry_sdk
|
|
10
|
+
from sentry_sdk.integrations.ray import RayIntegration
|
|
11
|
+
|
|
12
|
+
dsn = os.getenv('SENTRY_DSN')
|
|
13
|
+
if dsn is None:
|
|
14
|
+
return
|
|
15
|
+
|
|
16
|
+
sentry_sdk.init(
|
|
17
|
+
dsn=dsn,
|
|
18
|
+
environment=os.getenv('DEPLOYMENT_TARGET', 'development'),
|
|
19
|
+
integrations=[RayIntegration()],
|
|
20
|
+
send_default_pii=True,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def worker_process_setup_hook(*_, **__):
|
|
25
|
+
init_sentry()
|
synapse_sdk/shared/enums.py
CHANGED
|
@@ -2,7 +2,100 @@ from enum import Enum
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class Context(str, Enum):
|
|
5
|
+
"""Context levels for logging and message categorization.
|
|
6
|
+
|
|
7
|
+
This enum defines different context levels that can be used for logging messages,
|
|
8
|
+
UI feedback, and other categorization purposes throughout the application.
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
# In logging methods
|
|
12
|
+
self.log_message("Operation completed", context=Context.SUCCESS.value)
|
|
13
|
+
self.log_message("Warning: deprecated method", context=Context.WARNING.value)
|
|
14
|
+
|
|
15
|
+
# In LOG_MESSAGES dictionary
|
|
16
|
+
LOG_MESSAGES = {
|
|
17
|
+
'SUCCESS_CODE': {'message': 'Success!', 'level': Context.SUCCESS},
|
|
18
|
+
'ERROR_CODE': {'message': 'Error occurred', 'level': Context.DANGER},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# In UI components for styling/theming
|
|
22
|
+
if context == Context.DANGER:
|
|
23
|
+
render_error_style()
|
|
24
|
+
elif context == Context.SUCCESS:
|
|
25
|
+
render_success_style()
|
|
26
|
+
|
|
27
|
+
Attributes:
|
|
28
|
+
INFO: General informational messages (neutral)
|
|
29
|
+
SUCCESS: Success messages and positive outcomes
|
|
30
|
+
WARNING: Warning messages for non-critical issues
|
|
31
|
+
DANGER: Error messages and critical failures
|
|
32
|
+
ERROR: Legacy error context (use DANGER for new implementations)
|
|
33
|
+
DEBUG: Debug-level messages for development
|
|
34
|
+
"""
|
|
35
|
+
|
|
5
36
|
INFO = 'info'
|
|
6
37
|
SUCCESS = 'success'
|
|
7
38
|
WARNING = 'warning'
|
|
8
39
|
DANGER = 'danger'
|
|
40
|
+
ERROR = 'error'
|
|
41
|
+
DEBUG = 'debug'
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class SupportedTools(Enum):
|
|
45
|
+
"""Enum for supported annotation tools.
|
|
46
|
+
|
|
47
|
+
* TODO: Need dynamic configuration by referencing apps/annotation/categories/{file_type}/settings.py.
|
|
48
|
+
* Currently difficult to configure due to non-standardized prompt file types.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
BOUNDING_BOX = 'bounding_box', 'bounding_box'
|
|
52
|
+
NAMED_ENTITY = 'named_entity', 'named_entity'
|
|
53
|
+
CLASSIFICATION = 'classification', 'classification'
|
|
54
|
+
POLYLINE = 'polyline', 'polyline'
|
|
55
|
+
KEYPOINT = 'keypoint', 'keypoint'
|
|
56
|
+
BOUNDING_BOX_3D = '3d_bounding_box', '3d_bounding_box'
|
|
57
|
+
IMAGE_SEGMENTATION = 'segmentation', 'image_segmentation'
|
|
58
|
+
VIDEO_SEGMENTATION = 'segmentation', 'video_segmentation'
|
|
59
|
+
SEGMENTATION_3D = '3d_segmentation', '3d_segmentation'
|
|
60
|
+
POLYGON = 'polygon', 'polygon'
|
|
61
|
+
RELATION = 'relation', 'relation'
|
|
62
|
+
GROUP = 'group', 'group'
|
|
63
|
+
PROMPT = 'prompt', 'prompt'
|
|
64
|
+
ANSWER = 'answer', 'answer'
|
|
65
|
+
|
|
66
|
+
def __init__(self, annotation_tool, method_name):
|
|
67
|
+
self.annotation_tool = annotation_tool
|
|
68
|
+
self.method_name = method_name
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def get_all_values(cls):
|
|
72
|
+
"""Get all tool values as a list."""
|
|
73
|
+
return [tool.value for tool in cls]
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def get_tools_for_file_type(cls, file_type):
|
|
77
|
+
"""Get tools supported for a specific file type."""
|
|
78
|
+
basic_tools = [cls.RELATION, cls.GROUP, cls.CLASSIFICATION]
|
|
79
|
+
|
|
80
|
+
if file_type == 'image':
|
|
81
|
+
basic_tools.extend([
|
|
82
|
+
cls.BOUNDING_BOX,
|
|
83
|
+
cls.POLYLINE,
|
|
84
|
+
cls.KEYPOINT,
|
|
85
|
+
cls.IMAGE_SEGMENTATION,
|
|
86
|
+
cls.POLYGON,
|
|
87
|
+
])
|
|
88
|
+
elif file_type == 'video':
|
|
89
|
+
basic_tools.extend([
|
|
90
|
+
cls.BOUNDING_BOX,
|
|
91
|
+
cls.POLYLINE,
|
|
92
|
+
cls.KEYPOINT,
|
|
93
|
+
cls.VIDEO_SEGMENTATION,
|
|
94
|
+
cls.POLYGON,
|
|
95
|
+
])
|
|
96
|
+
elif file_type == 'pcd':
|
|
97
|
+
basic_tools.extend([cls.BOUNDING_BOX_3D, cls.SEGMENTATION_3D])
|
|
98
|
+
elif file_type == 'text':
|
|
99
|
+
basic_tools.extend([cls.PROMPT, cls.ANSWER, cls.NAMED_ENTITY])
|
|
100
|
+
|
|
101
|
+
return basic_tools
|