File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 51
51
SharedProcessScope ,
52
52
)
53
53
from trinity .plugins .registry import (
54
- ENABLED_PLUGINS
54
+ ALL_PLUGINS ,
55
55
)
56
56
from trinity .utils .ipc import (
57
57
wait_for_ipc ,
@@ -377,6 +377,6 @@ async def handle_networking_exit(service: BaseService,
377
377
def setup_plugins (scope : BaseManagerProcessScope ) -> PluginManager :
378
378
plugin_manager = PluginManager (scope )
379
379
# TODO: Implement auto-discovery of plugins based on some convention/configuration scheme
380
- plugin_manager .register (ENABLED_PLUGINS )
380
+ plugin_manager .register (ALL_PLUGINS )
381
381
382
382
return plugin_manager
Original file line number Diff line number Diff line change @@ -33,11 +33,19 @@ def is_ipython_available() -> bool:
33
33
# we'll be able to load plugins from some path and control via Trinity
34
34
# config file which plugin is enabled or not
35
35
36
- ENABLED_PLUGINS = [
36
+ BUILTIN_PLUGINS = [
37
37
AttachPlugin () if is_ipython_available () else AttachPlugin (use_ipython = False ),
38
38
EthstatsPlugin (),
39
39
FixUncleanShutdownPlugin (),
40
40
JsonRpcServerPlugin (),
41
41
LightPeerChainBridgePlugin (),
42
42
TxPlugin (),
43
43
]
44
+
45
+ # Plugins need to define entrypoints at 'trinity.plugins' to automatically get loaded
46
+ # https://packaging.python.org/guides/creating-and-discovering-plugins/#using-package-metadata
47
+ DISCOVERED_PLUGINS = [
48
+ entry_point .load ()() for entry_point in pkg_resources .iter_entry_points ('trinity.plugins' )
49
+ ]
50
+
51
+ ALL_PLUGINS = BUILTIN_PLUGINS + DISCOVERED_PLUGINS
You can’t perform that action at this time.
0 commit comments