synapse-sdk 1.0.0a76__py3-none-any.whl → 1.0.0a77__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synapse-sdk
3
- Version: 1.0.0a76
3
+ Version: 1.0.0a77
4
4
  Summary: synapse sdk
5
5
  Author-email: datamaker <developer@datamaker.io>
6
6
  License: MIT
@@ -110,7 +110,6 @@ synapse_sdk/plugins/enums.py,sha256=ibixwqA3sCNSriG1jAtL54JQc_Zwo3MufwYUqGhVncc,
110
110
  synapse_sdk/plugins/exceptions.py,sha256=Qs7qODp_RRLO9y2otU2T4ryj5LFwIZODvSIXkAh91u0,691
111
111
  synapse_sdk/plugins/models.py,sha256=AKZfVT6hsVEklcEDnHwoVAwvLxydMibfeJetug3Qk0U,4738
112
112
  synapse_sdk/plugins/upload.py,sha256=VJOotYMayylOH0lNoAGeGHRkLdhP7jnC_A0rFQMvQpQ,3228
113
- synapse_sdk/plugins/utils.py,sha256=039LZ1KjrBwGV-PnCnvbUr6ek6CNg8X67ccPuiQmVJg,4142
114
113
  synapse_sdk/plugins/categories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
115
114
  synapse_sdk/plugins/categories/base.py,sha256=ZBgRh3tTdSnqBrzjux8oi1_3PidHMmpmLClPXiTmU3Q,10690
116
115
  synapse_sdk/plugins/categories/decorators.py,sha256=Gw6T-UHwpCKrSt596X-g2sZbY_Z1zbbogowClj7Pr5Q,518
@@ -221,9 +220,9 @@ synapse_sdk/utils/storage/providers/gcp.py,sha256=i2BQCu1Kej1If9SuNr2_lEyTcr5M_n
221
220
  synapse_sdk/utils/storage/providers/http.py,sha256=2DhIulND47JOnS5ZY7MZUex7Su3peAPksGo1Wwg07L4,5828
222
221
  synapse_sdk/utils/storage/providers/s3.py,sha256=ZmqekAvIgcQBdRU-QVJYv1Rlp6VHfXwtbtjTSphua94,2573
223
222
  synapse_sdk/utils/storage/providers/sftp.py,sha256=_8s9hf0JXIO21gvm-JVS00FbLsbtvly4c-ETLRax68A,1426
224
- synapse_sdk-1.0.0a76.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
225
- synapse_sdk-1.0.0a76.dist-info/METADATA,sha256=As3anxeM7NReBSvXnTprXQG-yqgVpYhRlZL95bWMzeM,3805
226
- synapse_sdk-1.0.0a76.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
227
- synapse_sdk-1.0.0a76.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
228
- synapse_sdk-1.0.0a76.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
229
- synapse_sdk-1.0.0a76.dist-info/RECORD,,
223
+ synapse_sdk-1.0.0a77.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
224
+ synapse_sdk-1.0.0a77.dist-info/METADATA,sha256=zNj-Z1w6d0xO7AcphTa0fU0zeN_9pTuKct48zs6m_kA,3805
225
+ synapse_sdk-1.0.0a77.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
226
+ synapse_sdk-1.0.0a77.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
227
+ synapse_sdk-1.0.0a77.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
228
+ synapse_sdk-1.0.0a77.dist-info/RECORD,,
@@ -1,142 +0,0 @@
1
- import json
2
- from pathlib import Path
3
-
4
- 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
- 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
-
32
- def get_action_class(category, action):
33
- register_actions()
34
- return _REGISTERED_ACTIONS[category][action]
35
-
36
-
37
- def get_available_actions(category):
38
- register_actions()
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 get_plugin_actions(config=None, plugin_path=None):
47
- """Get list of action names from plugin configuration.
48
-
49
- Args:
50
- config: Plugin configuration dictionary. If None, reads from plugin_path.
51
- plugin_path: Path to plugin directory. Used if config is None.
52
-
53
- Returns:
54
- List of action names defined in the plugin.
55
- """
56
- if config is None:
57
- if plugin_path is None:
58
- config = read_plugin_config()
59
- else:
60
- config = read_plugin_config(plugin_path)
61
-
62
- if 'actions' not in config:
63
- raise KeyError("'actions' key not found in plugin configuration")
64
-
65
- actions = config['actions']
66
- if not isinstance(actions, dict):
67
- raise ValueError("'actions' must be a dictionary")
68
-
69
- return list(actions.keys())
70
-
71
-
72
- def read_plugin_config(plugin_path=None):
73
- """Legacy function for backward compatibility."""
74
- config_file_name = 'config.yaml'
75
- if plugin_path:
76
- config_path = Path(plugin_path) / config_file_name
77
- else:
78
- config_path = config_file_name
79
- return get_dict_from_file(config_path)
80
-
81
-
82
- def read_requirements(file_path):
83
- file_path = Path(file_path)
84
- if not file_path.exists():
85
- return None
86
-
87
- requirements = []
88
- for line in file_path.read_text().splitlines():
89
- stripped_line = line.strip()
90
- if stripped_line and not stripped_line.startswith('#'):
91
- requirements.append(stripped_line)
92
- return requirements
93
-
94
-
95
- def run_plugin(
96
- action,
97
- params,
98
- plugin_config=None,
99
- plugin_path=None,
100
- modules=None,
101
- requirements=None,
102
- envs=None,
103
- debug=False,
104
- **kwargs,
105
- ):
106
- from synapse_sdk.plugins.models import PluginRelease
107
-
108
- if not envs:
109
- envs = {}
110
-
111
- if debug:
112
- if plugin_path and plugin_path.startswith('http'):
113
- if not plugin_config:
114
- raise ActionError({'config': _('"plugin_path"가 url인 경우에는 "config"가 필수입니다.')})
115
- plugin_release = PluginRelease(config=plugin_config)
116
- else:
117
- plugin_release = PluginRelease(plugin_path=plugin_path)
118
- plugin_config = plugin_release.config
119
-
120
- if action not in plugin_release.actions:
121
- raise ActionError({'action': _('해당 액션은 존재하지 않습니다.')})
122
-
123
- if plugin_path:
124
- envs['SYNAPSE_DEBUG_PLUGIN_PATH'] = plugin_path
125
-
126
- if modules:
127
- envs['SYNAPSE_DEBUG_MODULES'] = ','.join(modules)
128
-
129
- else:
130
- if plugin_config is None:
131
- raise ActionError({'config': _('플러그인 설정은 필수입니다.')})
132
-
133
- action = get_action(
134
- action,
135
- params,
136
- config=plugin_config,
137
- requirements=requirements,
138
- envs=envs,
139
- debug=debug,
140
- **kwargs,
141
- )
142
- return action.run_action()