Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up Plugin architecture (modules + CLI) #98

Open
AntoineDao opened this issue Jun 9, 2020 · 0 comments
Open

Set up Plugin architecture (modules + CLI) #98

AntoineDao opened this issue Jun 9, 2020 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@AntoineDao
Copy link
Member

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
@AntoineDao AntoineDao added enhancement New feature or request help wanted Extra attention is needed labels Jun 9, 2020
@AntoineDao AntoineDao mentioned this issue Jun 9, 2020
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant