Code Monkey home page Code Monkey logo

hrishikeshvganu / pyan Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davidfraser/pyan

0.0 1.0 0.0 557 KB

pyan is a Python module that performs static analysis of Python code to determine a call dependency graph between functions and methods. This is different from running the code and seeing which functions are called and how often; there are various tools that will generate a call graph in that way, usually using debugger or profiling trace hooks - for example: https://pycallgraph.readthedocs.org/ This code was originally written by Edmund Horner, and then modified by Juha Jeronen. See README for the original blog posts and links to their repositories.

Python 100.00%

pyan's Introduction

pyan - Static Analysis of function and method call dependencies

pyan is a Python module that performs static analysis of Python code to determine a call dependency graph between functions and methods. This is different from running the code and seeing which functions are called and how often; there are various tools that will generate a call graph in that way, usually using debugger or profiling trace hooks - for example: https://pycallgraph.readthedocs.org/

This code was originally written by Edmund Horner, and then modified by Juha Jeronen. See the notes at the end of this file for the original blog posts and links to their repositories.

Command-line options

Output format (one of these is required)

  • --dot Output to GraphViz
  • --tgf Output in Trivial Graph Format

GraphViz only options

  • Color nodes automatically (-c or --colored). A HSL color model is used, picking the hue based on the top-level namespace (effectively, the module). The colors start out light, and then darken for each level of nesting. Seven different hues are available, cycled automatically.
  • Group nodes in the same namespace (-g or --grouped, -e or --nested-groups). GraphViz clusters are used for this. The namespace name is used as the cluster label. Groups can be created as standalone (-g or --grouped, always inside top-level graph) or nested (-e or --nested-groups). The nested mode follows the namespace structure of the code.

Generation options

  • Disable generation of links for “defines” relationships (-n or --no-defines). This can make the resulting graph look much clearer, when there are a lot of “uses” relationships. This is especially useful for layout with fdp. To enable (the default), use -u or --defines
  • Disable generation of links for “uses” relationships (-N or --no-uses). Can be useful for visualizing just where functions are defined. To enable (the default), use -u or --uses

General

  • -v or --verbose for verbose output
  • -h or --help for help

Drawing Style

The “defines” relations are drawn with gray arrows, so that it’s easier to visually tell them apart from the “uses” relations when there are a lot of edges of both types in the graph.

Nodes are always filled (white if color disabled), and made translucent to clearly show arrows passing underneath them. This is useful for large graphs with the fdp filter.

Original blog posts

Original source repositories

pyan's People

Contributors

technologicat avatar ejrh avatar

Watchers

Wabbit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.