How to use the entrypoints.reader.EntryPointsScanner.scan 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 / entrypoints / reader.py View on Github external
def iter_all_epinfo(path=None):
    # Distributions found earlier in path will shadow those with the same name
    # found later. If these distributions used different module names, it may
    # actually be possible to import both, but in most cases this shadowing
    # will be correct. pkg_resources does something similar.
    distro_names_seen = set()

    for location_ep in EntryPointsScanner().scan(path):
        for distro in location_ep['distributions']:
            if distro['name'] in distro_names_seen:
                continue
            distro_names_seen.add(distro['name'])

            for epinfo in distro['entrypoints']:
                yield (distro, epinfo)