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.
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.
Package matplotlib is required to run the included Jupyter Notebook examples.
Package pytest is
required to run the tests (pytest
in the repository root directory).
Packages sphinx,
sphinx-bootstrap-theme,
and numpydoc are required to build
the documentation (make html
in the docs
directory).
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
python 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 is available online at Read the
Docs, or can be built from the docs
directory of
the source distribution by the command
make html
in which case the HTML documentation can be found in the
build/sphinx/html
directory (the top-level document is index.html
).
Please submit bug reports, comments, etc. via the GitHub Issues interface.
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.