2

I've just started working with Sphinx and I need to generate a diagram showing the dependencies between different functions (some of which may be part of an object).

Sphinx can produce very nice inheritance diagrams, but I need to show the relationships between functions, not objects. I have produced something myself using Graphviz but it doesn't (yet) work with object methods and the outputs can't easily be imported into Sphinx documentation.

Example functions:

def function1():
    return 1

def function2():
    return function1() * 2

def function3():
    return function1() + function2()

And an example with objects:

class MyObject:
    def __init__(self):
      pass

    def function1(self):
        return 1

    def function2(self):
        return self.function1() * 2

    def function3(self):
        return self.function1() + self.function2()

I am looking to create a graph like this for the examples above.

Ideally it would be generated using Sphinx and/or be able to be automatically generated and be able to be automatically placed in Sphinx documentation. Is there an easy way of doing this?

jwodder
  • 54,758
  • 12
  • 108
  • 124
SqrtPi
  • 121
  • 2
  • 11

0 Answers0