GithubHelp home page GithubHelp logo

bwohlberg / jonga Goto Github PK

View Code? Open in Web Editor NEW
49.0 2.0 6.0 1.25 MB

Jonga: Python function call graph visualization

License: GNU General Public License v2.0

Python 100.00%
call-graph code-visualization dependency-graph call-graph-analysis documentation-tool

jonga's Introduction

Jonga

Build Status

Documentation Status

PyPi Release

PyPi Downloads

Conda Forge Release

Conda Forge Downloads

Supported Python Versions

Package License

Binder

Jonga is a Python package that generates a directed graph representing function calls within a block of Python code, intended for inclusion in Sphinx package documentation. There are a number of alternative packages with similar goals, including

but none of them is entirely suitable for generating function/method call vizualizations for inclusion within package documentation. In particular, none of these other packages correctly identifies method classes within a hierarchy of derived classes.

Requirements

The primary requirement is Python 3.3 or greater (this packages is not compatible with Python 2), imposed by the use of the __qualname__ function attribute and inspect.getclosurevars. The __qualname__ attribute could be replaced in earlier versions of Python by qualname, but there is no obvious replacement for inspect.getclosurevars, which was introduced in Python 3.3.

The other major requirement is pygraphviz. Under Ubuntu Linux 18.04, this requirement can be installed by the command

sudo apt-get install python3-pygraphviz

Optional

Package matplotlib is required to run the included Jupyter Notebook examples.

Packages pytest and pytest-runner are required to run the tests (python setup.py test or python3 setup.py test, depending on the operating system).

Packages sphinx, sphinx-bootstrap-theme, and numpydoc are required to build the documentation (python setup.py build_sphinx or python3 setup.py build_sphinx, depending on the operating system).

Usage

Scripts illustrating usage of the package can be found in the examples directory of the source distribution. These examples can be run from the root directory of the package by, for example

python3 examples/example1.py

To run these scripts prior to installing the package it will be necessary to first set the PYTHONPATH environment variable to include the root directory of the package. For example, in a bash shell

export PYTHONPATH=$PYTHONPATH:`pwd`

from the root directory of the package.

Jupyter Notebook versions of the example scripts are also included in the examples directory, and can be viewed online via nbviewer, or run interactively at binder.

Documentation

Documentation is available online at Read the Docs, or can be built from the root directory of the source distribution by the command

python3 setup.py build_sphinx

in which case the HTML documentation can be found in the build/sphinx/html directory (the top-level document is index.html).

Contact

Please submit bug reports, comments, etc. to [email protected]. Bugs and feature requests can also be reported via the GitHub Issues interface.

License

This package is made available under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License (see the included LICENSE file), or (at your option) any later version.

jonga's People

Contributors

bwohlberg avatar dangirsh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jonga's Issues

How to use on functions?

Let say I have a very simple program,

from IPython.display import SVG
import jonga

def step(x):
    return x + 1

ct = jonga.CallTracer(srcmodflt='[^IPython]', grpflt='^[^\.]*')

ct.start()
step(2)
ct.stop()

g = ct.graph(fntsz=10, fntfm=fntfm)

SVG(g.draw(format='svg'))

It returns empty SVG. I have a code that very deep in functions dependencies.

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.