Package pluginconf

Plugin meta extraction and module lookup

  • Main function plugin_meta(filename=…) unpacks meta fields into dictionaries.
  • Other utility code is about module location, but requires some initialization.

#

Sub-modules

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

Simulates setuptools.setup()

Functions

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

Utility function which collect defaults from plugin meta data to a config store. Which in the case of streamtuner2 is really just a dictionary conf{} and a plugin list in conf.plugins{}.

Parameters

conf_options : dict : input/output
storage for amassed options
conf_plugins : dict : input/output
enable status based on plugin state/priority:
meta : dict
input plugin meta data (invoke once per plugin)
module : str
basename of meta: blocks plugin file
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.

Returns

dict : names to meta data dict
 
def get_data(filename, decode=False, gzip=False, file_base=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 module_base / plugin_base as top-level reference.

Parameters

filename :  str
filename in pyz or bundle
decode : bool
text file decoding utf-8
gzip : bool
automatic gzdecode
file_base : list
alternative base module reference

Returns

str : file contents
 
def module_list(extra_paths=None)

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

Parameters

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 different sources:

Parameters

filename : str
Read literal files, or .pyz contents.
src : str
From already uncovered script code.
module : str
Lookup per pkgutil, from plugin_base or top-level modules.
frame : int
Extract comment header of caller (default).
extra_base : list
Additional search directories.
max_length : list
Maximum size to read from files.

Returns

dict : Extracted comment fields, with config: preparsed
 

Classes

class PluginMeta (*args, **kwargs)

Plugin meta data, as dictionary with alternative .property access. Returned for each plugin_meta() result, and config: options. Non-existent .fieldnames just resolve to "".

Ancestors

  • builtins.dict