Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 869 Bytes

File metadata and controls

29 lines (21 loc) · 869 Bytes

#python-project-dependency-graphs

A simple tool to detect cyclic imports in python projects.

Usage example

    pip install -r requirements.txt
    detect.sh <<path to project>>
    Output:
    Found 1 cycles:
    ('project/api.py', 'project/dbmsr.py')
    snakefood file: /tmp/tmp.tFNLIl2J55
    dot file: /tmp/tmp.YvcNtf92Rq

This builds the dependency graph of the project with snakefood. Then uses that with networkx to find cycles. The output is one tuple for each cycle it finds.

The script outputs the snakefood file and a dot file written to /tmp that you can use later.

The dot file can be used to generate a visual representation of your project's dependency graph.

    ubuntu_requirements.sh
    dot -T pdf <<generated dot file>> > <<output file>>