How to use the entrypoints.entry_point_pattern function in entrypoints

To help you get started, we’ve selected a few entrypoints examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github takluyver / entrypoints / hybrid_cache.py View on Github external
def entrypoints_from_configparser(cp):
    res = []
    for group_name, group in sorted(cp.items()):
        for name, epstr in sorted(group.items()):
            m = entry_point_pattern.match(epstr)
            if m:
                mod, obj, extras = m.group('modulename', 'objectname', 'extras')
                if extras is not None:
                    extras = [e.strip() for e in extras.split(',')]
                res.append({
                    'group': group_name,
                    'name': name,
                    'module_name': mod,
                    'object_name': obj,
                    'extras': extras,
                })
            else:
                log.warning("Invalid entry point specification: %r", epstr)
    return res