generated from movestore/Template_Python_App
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsdk.py
More file actions
30 lines (23 loc) · 833 Bytes
/
sdk.py
File metadata and controls
30 lines (23 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pluggy
from sdk.moveapps_spec import MoveAppsSpec, HOOK_NAMESPACE
from sdk.moveapps_io import MoveAppsIo
from sdk.moveapps_execution import MoveAppsExecutor
PROJECT_NAME = "co-pilot-python"
class MoveAppsSdk:
def __init__(self, active_hooks=None) -> None:
"""
Setup the plugin manager and register all the hooks.
"""
self._pm = pluggy.PluginManager(HOOK_NAMESPACE)
self._pm.add_hookspecs(MoveAppsSpec)
self.hooks = active_hooks
if self.hooks:
for hook in self.hooks:
self._pm.register(hook)
executor = MoveAppsExecutor(plugin_manager=self._pm)
executor.execute()
if __name__ == "__main__":
from app.app import App
# LIFO
hooks = [App(moveapps_io=MoveAppsIo())]
sdk = MoveAppsSdk(active_hooks=hooks)