CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-indico

Comprehensive web-based event management and conference lifecycle management platform.

Pending
Overview
Eval results
Files

plugin-development.mddocs/

Plugin Development

The Indico plugin system provides a comprehensive framework for extending functionality through custom plugins. Plugins can add new features, integrate with external systems, customize user interfaces, and extend core application behavior while maintaining clean separation from the core codebase.

Capabilities

Base Plugin Class

The foundation class for all Indico plugins, providing configuration management, lifecycle hooks, and integration points.

class IndicoPlugin:
    """
    Base class for all Indico plugins.
    
    Attributes:
    - settings_form: WTForm class for plugin settings (requires configurable=True)
    - default_settings: dict, default plugin settings
    - default_event_settings: dict, default event-specific settings
    - default_user_settings: dict, default user-specific settings
    - acl_settings: set, settings which store ACLs
    - configurable: bool, whether plugin should link to config page in admin interface
    - category: PluginCategory, plugin category enum value
    - strict_settings: bool, whether to use strict mode for settings
    """
    
    configurable: bool = False
    category: 'PluginCategory' = None
    default_settings: dict = {}
    default_event_settings: dict = {}
    default_user_settings: dict = {}
    acl_settings: set = set()
    strict_settings: bool = True
    
    def init(self):
        """
        Called when plugin is loaded/initialized.
        Override to perform plugin-specific initialization.
        """
    
    def get_blueprints(self):
        """
        Return blueprints to be registered on application.
        
        Returns:
        list: List of Flask blueprints to register
        """
    
    def get_vars_js(self):
        """
        Return dictionary with variables for vars.js file.
        
        Returns:
        dict: Variables to inject into JavaScript context
        """
    
    def connect(self, signal, receiver, **kwargs):
        """
        Connect signal to receiver function.
        
        Parameters:
        - signal: Signal to connect to
        - receiver: Function to handle the signal
        - **kwargs: Additional connection parameters
        """
    
    def inject_bundle(self, name, view_class=None, subclasses=True, condition=None):
        """
        Inject asset bundle into pages.
        
        Parameters:
        - name: str, bundle name
        - view_class: Class to inject into (optional, None for all pages)
        - subclasses: bool, whether to include subclasses
        - condition: callable, condition for injection
        """
    
    def template_hook(self, name, receiver, priority=50, markup=True):
        """
        Register template hook function.
        
        Parameters:
        - name: str, hook name
        - receiver: callable, hook function
        - priority: int, hook priority (lower = earlier)
        - markup: bool, whether receiver returns markup
        """

Settings Management

Plugin settings are managed through proxy objects that provide access to different setting scopes.

@property
def settings(self):
    """
    SettingsProxy for plugin settings.
    
    Returns:
    SettingsProxy: Global plugin settings
    """

@property  
def event_settings(self):
    """
    EventSettingsProxy for event-specific settings.
    
    Returns:
    EventSettingsProxy: Event-specific plugin settings
    """

@property
def user_settings(self):
    """
    UserSettingsProxy for user-specific settings.
    
    Returns:
    UserSettingsProxy: User-specific plugin settings
    """

Plugin Categories

Enumeration defining the available plugin categories for organization and filtering.

class PluginCategory:
    """Plugin category enumeration."""
    
    search = "search"
    synchronization = "synchronization"
    payment = "payment"
    importers = "importers"
    videoconference = "videoconference"
    other = "other"

Plugin Blueprint

Specialized Flask blueprint class for plugins with proper context handling and static folder support.

class IndicoPluginBlueprint:
    """
    Blueprint class for plugins with proper context handling.
    Extends Flask Blueprint with plugin-specific functionality.
    """

Plugin Engine

The plugin management system that handles plugin loading, registration, and lifecycle management.

plugin_engine: 'IndicoPluginEngine'
"""Plugin engine instance for managing plugins."""

Utility Functions

Helper functions for plugin development and integration.

def plugin_url_rule_to_js(endpoint):
    """
    Convert plugin endpoint to JavaScript format.
    
    Parameters:
    - endpoint: str, plugin endpoint name
    
    Returns:
    str: JavaScript-compatible URL rule
    """

def url_for_plugin(endpoint, *targets, **values):
    """
    Generate URLs for plugin endpoints.
    
    Parameters:
    - endpoint: str, plugin endpoint
    - *targets: positional arguments for URL generation
    - **values: keyword arguments for URL generation
    
    Returns:
    str: Generated URL
    """

def get_plugin_template_module(template_name, **context):
    """
    Get plugin template module.
    
    Parameters:
    - template_name: str, template file name
    - **context: template context variables
    
    Returns:
    Template module for rendering
    """

Plugin Development Examples

Basic Plugin Structure

from indico.core.plugins import IndicoPlugin, PluginCategory

class MyPlugin(IndicoPlugin):
    """Example plugin demonstrating basic structure."""
    
    # Plugin metadata
    configurable = True
    category = PluginCategory.other
    
    # Default settings
    default_settings = {
        'enabled': True,
        'api_key': '',
        'timeout': 30
    }
    
    default_event_settings = {
        'feature_enabled': False
    }
    
    def init(self):
        """Initialize plugin when loaded."""
        super().init()
        # Connect to signals
        self.connect('event_created', self._on_event_created)
    
    def get_blueprints(self):
        """Register plugin blueprints."""
        from .blueprint import bp
        return [bp]
    
    def _on_event_created(self, event, **kwargs):
        """Handle event creation."""
        if self.event_settings.get(event, 'feature_enabled'):
            # Custom logic for new events
            pass

Plugin with Web Interface

from flask import render_template, request
from indico.core.plugins import IndicoPluginBlueprint

# Blueprint definition
bp = IndicoPluginBlueprint('my_plugin', __name__)

@bp.route('/config')
def config():
    """Plugin configuration page."""
    return render_template('my_plugin:config.html')

@bp.route('/api/data')
def api_data():
    """Plugin API endpoint."""
    return {'status': 'ok', 'data': []}

Plugin with Template Hooks

def init(self):
    """Initialize plugin with template hooks."""
    super().init()
    
    # Add content to event pages
    self.template_hook('event-header', self._inject_header_content)
    
    # Add JavaScript variables
    self.inject_bundle('plugin_js', 'events.display')

def _inject_header_content(self, event, **kwargs):
    """Inject content into event header."""
    if self.event_settings.get(event, 'show_banner'):
        return render_template('my_plugin:banner.html', event=event)

Plugin Registration

Plugins are registered through Python entry points in the package configuration:

[project.entry-points."indico.plugins"]
my_plugin = "my_plugin:MyPlugin"

Install with Tessl CLI

npx tessl i tessl/pypi-indico

docs

cli-commands.md

index.md

plugin-development.md

testing-utilities.md

tile.json