mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-12 02:55:43 +00:00
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
import pluggy
|
|
from . import default_plugin # Import the default plugin
|
|
|
|
# ✅ Ensure that the namespace in HookspecMarker matches PluginManager
|
|
PLUGIN_NAMESPACE = "conditions"
|
|
|
|
hookspec = pluggy.HookspecMarker(PLUGIN_NAMESPACE)
|
|
hookimpl = pluggy.HookimplMarker(PLUGIN_NAMESPACE)
|
|
|
|
|
|
class ConditionsSpec:
|
|
"""Hook specifications for extending JSON Logic conditions."""
|
|
|
|
@hookspec
|
|
def register_operators():
|
|
"""Return a dictionary of new JSON Logic operators."""
|
|
pass
|
|
|
|
@hookspec
|
|
def register_operator_choices():
|
|
"""Return a list of new operator choices."""
|
|
pass
|
|
|
|
@hookspec
|
|
def register_field_choices():
|
|
"""Return a list of new field choices."""
|
|
pass
|
|
|
|
|
|
# ✅ Set up Pluggy Plugin Manager
|
|
plugin_manager = pluggy.PluginManager(PLUGIN_NAMESPACE)
|
|
|
|
# ✅ Register hookspecs (Ensures they are detected)
|
|
plugin_manager.add_hookspecs(ConditionsSpec)
|
|
|
|
# ✅ Register built-in plugins manually
|
|
plugin_manager.register(default_plugin, "default_plugin")
|
|
|
|
# ✅ Discover installed plugins from external packages (if any)
|
|
plugin_manager.load_setuptools_entrypoints(PLUGIN_NAMESPACE)
|