Package pluginconf
Plugin meta extraction and module lookup.
|
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 toPluginBase(searchpath=…)
)
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 inconf.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_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.
Parameters
extra_paths
:list
- in addition to plugin_base list
Returns
list
:names
offound 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, 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 (6K default).
Returns
dict
:Extracted comment fields, with config: preparsed
The result dictionary has fields accessible as e.g.
pmd["title"]
orpmd.version
. The documentation block after all fields: is called ["doc"]. And
pmd.config` already parsed as a list 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 eachplugin_meta()
result, and individualconfig:
options. Absent.field
access resolves to""
.Ancestors
- builtins.dict