import logging
import pkg_resources

LOGGER = logging.getLogger(__name__)
PLUGINS = {}
def load():
    for entry in pkg_resources.iter_entry_points(group='mothermayi'):
        runner = entry.load()
        plugin = runner()
        LOGGER.debug("Loaded plugin %s", plugin['name'])
        if plugin['name'] in PLUGINS:
            raise Exception("Already have a plugin with the name {}, cannot overwrite".format(plugin['name']))

        PLUGINS[plugin['name']] = plugin

def get_plugins(name):
    return {k: v for k, v in PLUGINS.items() if name in v}

import logging
import pkg_resources

LOGGER = logging.getLogger(__name__)
PLUGINS = {}
def load():
    for entry in pkg_resources.iter_entry_points(group='mothermayi'):
        runner = entry.load()
        plugin = runner()
        plugin['dist'] = entry.dist
        LOGGER.debug("Loaded plugin %s from %s", plugin['name'], entry.dist)
        existing_plugin = PLUGINS.get(plugin['name'], None)
        if existing_plugin and existing_plugin['dist'] != plugin['dist']:
            LOGGER.warning("Overwriting plugin %s with %s", existing_plugin, plugin)

        PLUGINS[plugin['name']] = plugin

def get_plugins(name):
    return {k: v for k, v in PLUGINS.items() if name in v}

Raise a warning instead of failing on plugin overwrite
Raise a warning instead of failing on plugin overwrite

I'm not sure why but my local developer versions of plugins are
registering more than once with different names. I think it might be
because I have a difference between the package name and the module
name. Not sure. Anyways, I'm going to change this for now with a nice
large warning so that I can keep an eye on it and keep developing
