Skip to content

Set up Plugin architecture (modules + CLI) #98

@AntoineDao

Description

@AntoineDao

Currently the CLI side of queenbee supports a plugin architecture through the use of click-plugins however we do not use such a system for normal modules. ie: auth config classes and functions must all be defined in queenbee and cannot be imported from another plugin module.

This issue is raised in relation to this comment specifically. I agree that this is the preferable way forward but would like to tackle this issue properly at a later date so I can carry on with other dev work.

Some thoughts on plugin architecture reworks:

  • Do it like the other ladybug-tools libraries using an importer in the parent package init
"""Honeybee core library."""
import importlib
import pkgutil
from honeybee.logutil import get_logger


logger = get_logger(__name__)

#  find and import honeybee extensions
#  this is a critical step to add additional functionalities to honeybee core library.
extensions = {}
for finder, name, ispkg in pkgutil.iter_modules():
    if not name.startswith('honeybee_') or name.count('_') > 1:
        continue
    try:
        extensions[name] = importlib.import_module(name)
    except Exception:
        logger.exception('Failed to import {0}!'.format(name))
    else:
        logger.info('Successfully imported Honeybee plugin: {}'.format(name))
  • Use pop by the creator of saltstack. Here's a good pocast episode about it and here's their docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions