

def installed_packages(local=False):
    installed = []
    for dist in get_installed_distributions(local_only=local):
        pym = PyModule(dist.project_name, dist.version, dist.location)
        if dist.has_metadata('top_level.txt'):
            pym.set_import_names(list(dist.get_metadata_lines('top_level.txt')))
        pym.local = dist_is_local(dist)
        pym.user = dist_in_usersite(dist)
        pym._dependencies = [dep.project_name for dep in dist.requires()]
        for filename in iter_dist_files(dist):
            if (not filename.startswith(dist.location)):
                if is_script(filename):
                    pym.installed_scripts.append(filename)
                else:
                    pym.installed_files.append(filename)
        if (pym.installed_scripts or (pym.name in ignore_packages)):
            pym.hidden = True
        installed.append(pym)
    for pym in installed[:]:
        for dep in pym._dependencies:
            if (dep == 'argparse'):
                continue
            pymc = find_package(dep, installed, True)
            if (not pymc):
                pymc = PyModule(dep, 'MISSING', missing=True)
                installed.append(pymc)
            pymc.add_dependant(pymc)
            pym.add_dependency(pymc)
    return installed

dataset/ETHPy150Open tweekmonster/moult/moult/utils.py installed_packages/VarMisuse@274/353 `pym`->`pymc`