How to use the pipdeptree.cyclic_deps function in pipdeptree

To help you get started, we’ve selected a few pipdeptree 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 naiquevin / pipdeptree / tests / test_pipdeptree.py View on Github external
def test_cyclic_dependencies():
    cyclic_pkgs, dist_index, tree = venv_fixture('tests/virtualenvs/cyclicenv.pickle')
    cyclic = [map(attrgetter('key'), cs) for cs in cyclic_deps(tree)]
    assert len(cyclic) == 2
    a, b, c = cyclic[0]
    x, y, z = cyclic[1]
    assert a == c == y
    assert x == z == b
github sbg / dante / dante / core / commands.py View on Github external
def get_cyclic_dependencies(tree):
    """Returns sorted cyclic dependencies
    :param tree: dictionary of dependencies
    :return: sorted dict of cyclic dependencies
    """
    cyclic_dependencies = dict(pipdeptree.cyclic_deps(tree))

    if cyclic_dependencies:
        cyclic_data = []
        for package in sorted(
                cyclic_dependencies,
                key=lambda p: p.key):
            for dependency in sorted(
                    cyclic_dependencies[package],
                    key=lambda d: d.key):
                cyclic_data.append([
                    printer.printable_package(dependency.key),
                    package.key,
                    get_required_package_version(dependency),
                    get_installed_package_version(dependency)
                ])
        return cyclic_data