Package pluginconf

Plugin meta extraction and module lookup.

  • Main function plugin_meta() unpacks meta fields into dictionaries.
  • Other utility code is about module listing, relative to plugin_base anchors.
  • //pypi.org/project/pluginconf/
  • //fossil.include-once.org/pluginspec/
  • Sub-modules

    pluginconf.bind

    Basic plugin loader implementation for flat namespaces. Ties together pluginconf lookups and config management for plugin loading in apps. It's rather …

    pluginconf.depends

    Dependency validation and consistency checker for updates

    pluginconf.flit

    monkeypatches flit to use pluginconf sources for packaging with a pyproject.toml like: …

    pluginconf.gui

    PySimpleGUI window to populate config dict via plugin options …

    pluginconf.setup

    Expands setuptools.setup() with automatic package description lookup

    Global variables

    var config_opt_type_map

    normalize config type: names to str, text, bool, int, select, dict

    var data_root

    File lookup relation for get_data(), should name a top-level package. (Equivalent to PluginBase(package=…))

    var plugin_base

    Package/module names (or directories) for module_list() and plugin_meta() lookups. Associated paths (__path__) will be scanned for module/plugin basenames. (Similar to PluginBase(searchpath=…))

    Functions

    def add_plugin_defaults(conf_options, conf_plugins, meta, module='')

    Utility function to collect defaults from plugin meta data to a config dict/store.

    Parameters
    conf_options dict 🔁 storage for amassed #config: options
    conf_plugins dict 🔁 activation status derived from state/priority:
    meta dict input plugin meta data (invoke once per plugin)
    module str basename of meta: blocks plugin file
    Returns None -
    def all_plugin_meta()

    This is a trivial wrapper to assemble a complete dictionary of available/installed plugins. It associates each plugin name with a its meta{} fields.

    Parameters
    Returns dict names to PluginMeta dict
    def get_data(filename, decode=False, gzip=False, file_root=None)

    Fetches file content from install path or from within PYZ archive. This is just an alias and convenience wrapper for pkgutil.get_data(). Utilizes the data_root as top-level reference.

    Parameters
    filename str filename in pyz or bundle
    decode bool text file decoding utf-8
    gzip bool automatic gzdecode
    file_root list alternative base module (application or pyz root)
    Returns str file contents
    def module_list(extra_paths=None)

    Search through ./plugins/ (and other configured plugin_base names → paths) and get module basenames.

    Parameter
    extra_paths list in addition to plugin_base list
    Returns list names of found plugins
    def plugin_meta(filename=None, src=None, module=None, frame=1, **kwargs)

    Extract plugin meta data block from specified source.

    Parameters
    filename str Read literal files, or .pyz contents.
    src str From already uncovered script code.
    module str Lookup per pkgutil, relative to plugin_base
    frame int Extract comment header of caller (default).
    extra_base list Additional search directories.
    max_length list Maximum size to read from files (6K default).
    Returns dict Extracted comment fields, with config: preparsed

    The result dictionary (PluginMeta) has fields accessible as e.g. meta["title"] or meta.version. The documentation block after all fields: is called meta["doc"]. And meta.config already parsed as a list (OptionList) of dictionaries.

    Classes

    class OptionList (*args, **kwargs)

    List of config: options, with alernative .name access (lookup by name= from option entry).

    Ancestors

    • builtins.list
    class PluginMeta (*args, **kwargs)

    Plugin meta data as dictionary{}, or alternatively .property access. Returned for each plugin_meta() result, and individual config: options. Absent .field access resolves to "".

    Ancestors

    • builtins.dict