Skip to main content

Migration Guide (v1 to v2)

This guide covers the changes between synapse-sdk v1 and v2, including breaking changes that require code updates and new features.

Prerequisites

This guide assumes familiarity with synapse-sdk v1. Complete the Installation Guide for v2 setup.

Breaking Changes

These changes require code updates when migrating from v1:

v1v2Migration
get_action_class(category, action)get_action_method(config, action)Pass config dict instead of category string
action_class.methodget_action_method(config, action)Method is now read from config, not class attribute
@register_action decoratorRemovedDefine actions in config.yaml or use PluginDiscovery.from_module()
_REGISTERED_ACTIONS globalRemovedUse PluginDiscovery for action introspection
get_storage('s3://...') URL stringsDict-only configUse get_storage({'provider': 's3', 'configuration': {...}})
STORAGE_PROVIDERS dictget_registered_providers()Returns list of provider names instead of dict
convert_v1_to_v2()Not yet availableUse local DMV1ToV2Converter temporarily
AgentClient(long_poll_handler=...)RemovedLong poll handler no longer supported
run_debug_plugin_release(data=...)run_debug_plugin_release(action, params, ...)Use explicit keyword args instead of data dict
run_plugin_release(code, data=...)run_plugin_release(lookup, action, params, ...)Use explicit keyword args; data= still supported for backward compatibility
ClientError.statusClientError.status_codeAttribute renamed
ClientError.reasonClientError.detailAttribute renamed
RayJobExecutor(dashboard_address=...)RemovedDashboard URL no longer passed to executor
from ... import FileSystemStoragefrom ... import LocalStorageClass renamed
from ... import GCPStoragefrom ... import GCSStorageClass renamed
Subclassing BaseStorage ABCImplement StorageProtocolUse structural typing (duck typing) instead of inheritance

Non-Breaking Changes

These changes are backwards compatible - existing code continues to work:

FeatureNotes
Provider alias file_systemStill works, maps to LocalStorage
Provider aliases gcp, gsStill work, map to GCSStorage
get_plugin_actions()Same API
read_requirements()Same API
get_pathlib()Same API
get_path_file_count()Same API
get_path_total_size()Same API

Plugin Utils

Old (synapse-sdk v1)

from synapse_sdk.plugins.utils import get_action_class, get_plugin_actions, read_requirements

# Get run method by loading the action class
action_method = get_action_class(config['category'], action).method

New (synapse-sdk v2)

from synapse_sdk.plugins.utils import get_action_method, get_plugin_actions, read_requirements

# Get run method directly from config (no class loading needed)
action_method = get_action_method(config, action)

Plugin Types

Old

from synapse_sdk.plugins.enums import PluginCategory
from synapse_sdk.plugins.base import RunMethod

New

from synapse_sdk.plugins.enums import PluginCategory, RunMethod

Pre-Annotation Actions

Old (synapse-sdk v1)

from synapse_sdk.plugins.categories.pre_annotation.actions.to_task import ToTaskAction

class AnnotationToTask:
def convert_data_from_file(...):
...

def convert_data_from_inference(...):
...

action = ToTaskAction(run=run_instance, params=params)
result = action.start()

New (synapse-sdk v2)

from synapse_sdk.plugins.actions.to_task import ToTaskAction

class ToTask(ToTaskAction):
action_name = 'to_task'

def convert_data_from_file(...):
...

def convert_data_from_inference(...):
...

Update config.yaml to use the to_task action name and point the entrypoint to your ToTask subclass.

Design note: v1 used strategy/facade orchestration for to_task. v2 keeps the workflow in a single action class with helper methods for validation, task iteration, and inference, which makes debugging and customization simpler. If you need multi-step orchestration, use the step framework (synapse_sdk.plugins.steps).


Plugin Discovery

New feature - Discover actions from config files or Python modules:

from synapse_sdk.plugins.discovery import PluginDiscovery

# From config.yaml
discovery = PluginDiscovery.from_path('/path/to/plugin')
discovery.list_actions() # ['train', 'inference', 'export']

# From Python module (auto-discovers @action decorators and BaseAction subclasses)
import plugin
discovery = PluginDiscovery.from_module(plugin)

Storage Utils

Old (synapse-sdk v1)

from synapse_sdk.utils.storage import get_storage, get_pathlib

# URL string or dict config
storage = get_storage('s3://bucket?access_key=KEY&secret_key=SECRET')
# Or dict config
storage = get_storage({'provider': 'file_system', 'configuration': {'location': '/data'}})

New (synapse-sdk v2)

from synapse_sdk.utils.storage import get_storage, get_pathlib

# Dict-only config (URL string parsing removed)
storage = get_storage({'provider': 'local', 'configuration': {'location': '/data'}})

# S3 example
storage = get_storage({
'provider': 's3',
'configuration': {
'bucket_name': 'my-bucket',
'access_key': 'AKIAIOSFODNN7EXAMPLE',
'secret_key': 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
'region_name': 'us-east-1',
}
})

Provider Renames

  • file_system -> local (alias file_system still works)
  • FileSystemStorage -> LocalStorage
  • GCPStorage -> GCSStorage

New Features in v2

FeatureDescription
PluginDiscoveryDiscover actions from config files or Python modules
PluginDiscovery.from_module()Auto-discover @action decorators and BaseAction subclasses
StorageProtocolProtocol-based interface for custom storage implementations
HTTPStorage providerNew provider for HTTP file servers
Plugin Upload utilitiesarchive_and_upload(), build_and_upload(), download_and_upload()
File utilitiescalculate_checksum(), create_archive(), create_archive_from_git()
AsyncAgentClientAsync client with WebSocket/HTTP streaming for job logs
tail_job_logs()Stream job logs with protocol auto-selection

See Also