Skip to content

Latest commit

 

History

History
95 lines (74 loc) · 3.77 KB

README.org

File metadata and controls

95 lines (74 loc) · 3.77 KB

https://travis-ci.org/matthieu-bruneaux/pydep.svg?branch=master https://coveralls.io/repos/matthieu-bruneaux/pydep/badge.svg?branch=master

Description

Python utility to produce a simple graph of the dependencies between functions in a Python module.

This is a simple home-made project, the aim of which is to teach myself how to do this kind of analysis, learn how to package a Python module and enjoy some nice time coding. Note that there are more elaborated projects already existing (see at the end of this README).

Disclaimer: while I try to make this code correct, there is no guarantee that it is bug free. Use at your own risk!

Installation

  • You can clone the git repository with:
    git clone https://github.com/matthieu-bruneaux/pydep.git
        
  • You can then install the module with:
    sudo make install
        
  • To remove it, run (from the git repository folder):
    sudo make uninstall
        

    or from any folder:

    sudo pip uninstall pydep
        

Usage

  • You can see the detailed usage instructions with:
    pydep -h
        
  • You can produce a .dot file (to be processed by the dot utility from graphviz) from a Python module with:
    pydep tests/inputFiles/exampleModule.py > deps.dot
        
  • A pdf or png version of the graph can then be obtained with:
    dot -Tpdf deps.dot -o deps.pdf # pdf output
    dot -Tpng deps.dot -o deps.png # png output
        

Example output

Here is an example output:

https://github.com/matthieu-bruneaux/pydep/blob/master/tests/expectedFiles/pydep.png

Makefile

A Makefile is provided, type make to get some summary usage information:

Makefile for the pydep Python module                   
                                                                  
Type: "make <target>" where <target> is one of the following:   
                                                                  
  test             Run the tests with coverage output             
  doc              Run Sphinx to make the docs                    
  clean            Remove generated doc, tests and pyc files      
                                                                  
You need sudo rights for the following ones:                      
                                                                  
  install          Install the module and command-line tools      
  uninstall        Uninstall the module                           

Resources used

This project uses the ast built-in module from Python, about which I read when looking at the snakefood project.

Related projects

Those projects are more advanced and mature, that’s probably what you want to get if you need to analyse the dependencies in your project (disclaimer: this is the result of a Google search, I didn’t tested all of those projects myself!). The list is not exhaustive and might miss some interesting projects:

A quick search for “pydep” in GitHub might also return interesting hits.