mpackmanager Module This file supports discovery and loading of modules by path and filename pattern

Note that our term “pack” here is not referring to python packs (directories).

The pack system here is made up of 3 classes:

  • MewloPackManager - holds a list of Packs.
  • MewloPack - a thin wrapper around a pack object.
  • MewloPackWorker - the object that will be subclassed to do real work.

The MewloPack is the thing that is autocreated on discovery of a .json definition file. It will be instantiated even if this extension is disabled.

The PackWorker is only instantiated when the extension is enabled.

When you code a new plugin/extension, you ONLY create a derived MewloPackWorker class. The MewloPack is created by the manager.

class mewlo.mpacks.core.pack.mpackmanager.MewloPackManager(mewlosite, debugmode)[source]

Bases: mewlo.mpacks.core.manager.manager.MewloManager

The PackManager is a class that can be used to dynamically find modules by path and filename pattern. It manages a collection of Pack objects that represent addonsm, etc. It’s useful for plugin-discovery type things.


Given self.filepatternsuffix we create the file match pattern that describes the json info files we need to look for.

check_pack_dependencies(pack, requirer, assumegoodlist)[source]
Check whether this pack has its dependenices met. Return tuple (dependencies_met, reasontext).

In the json file this looks like: “requires”: {

“packs”: [“mouser.mewlotestplug”]


classwide_packmodules = {}

Create an appropriate child pack.

createadd_pack_frominfofile(infofilepath, eventlist)[source]

Given a path to an infofile, create a pack from it.

description = "Manages all 'MewloPacks' which are collections of files that can be updated"

Scan all pack directories and discover packs.


Discover any setuptools based entry-point plugins that are exposing their info.


Return a string (with newlines and indents) that displays some debugging useful information about the object.

findfilepaths(dirpath, filepattern)[source]

Find recursive list of filepaths matching pattern.


Return the pack object for the pack specified by id, or None if not found.


Get combined eventlist for all packs. We merge in fields about the pack so they are available for debugging.


Given a pack id, lookup its settings.


Check if there were any site prep errors, OR if any packs report they are not ready to run (need update, etc.).


Dynamically load an importbypath (or returned cached value of previous import).


Shutdown the packs.

startup_pack_auto(mewlosite, pack, eventlist)[source]

Before we instantiate a pack, we preprocess it using our settings, which may disable/enabe them.


Startup packs. We do this separately from normal startup() because we may want to check for updates first.

startup_prep(stageid, eventlist)[source]

This is invoked by site strtup, for each stage specified in startup_stages_needed() above.

typestr = 'core'

Check all packs for updates. The packs themselves will store details about update check results. Note this covers not just web updates available, but database updates needed.


Check all packs for updates. The packs themselves will store details about update check results. Note this covers not just web updates available, but database updates needed.

want_enable_pack(pack, eventlist)[source]

Do settings say to disable this pack? Return tuple of (flag_enable, reasonstring).

will_enable_pack_byid(packid, requirer, assumegoodlist)[source]

Check if pack will be enabled, by id.

Table Of Contents

This Page