Skip to content

GlobalRegistry

GlobalRegistry is a class-level key-value store for sharing data between plugins. FastPluggy extends it, so fast_pluggy and GlobalRegistry access the same store.

API

from fastpluggy.core.global_registry import GlobalRegistry

# Store / retrieve a single value
GlobalRegistry.register_global("my_key", my_value)
value  = GlobalRegistry.get_global("my_key", default=None)
exists = GlobalRegistry.has_global("my_key")

# Extend a list (deduplicates) or merge a dict
GlobalRegistry.extend_globals("topbar_actions", items=[TopbarAction(...)])
GlobalRegistry.extend_globals("fp_widgets",     items={"admin_home": my_widget})

# Introspection
all_data = GlobalRegistry.get_all_globals()

# Cleanup (mainly for tests)
GlobalRegistry.clear_globals()
GlobalRegistry.clear_globals_key("my_key")

Built-in keys

Key Type Set by Description
topbar_actions List[TopbarAction] Plugins (in on_load_complete) Topbar buttons, sorted by position before rendering
list_widget_to_inject List Plugins Widgets injected globally into every page (via ViewBuilder)
fp_widgets Dict[str, Widget] Plugins Named widget slots, e.g. "admin_home" for the home page

Conventions

  • Prefer calling extend_globals inside on_load_complete so all plugins are already discovered when you run (avoids ordering issues).
  • Use namespaced keys to avoid collisions: "my_plugin_data" not "data".
  • extend_globals for lists deduplicates using __hash__ / __eq__. TopbarAction uses id as its equality key, so registering the same id twice is idempotent.