python3 inheritance tree among files

80 Views Asked by At

I have python3 files with multiple classes. I am wondering if there is a tool that can generate the inheritance tree among all the python scripts?

I read about python class inheritance tree but it does not work:

  1. I created a virtual environment:

python3 -m venv tmp_python

source source tmp_python/bin/activate

  1. Then I created two files: a.py:
    class a(object): 
        pass
    class b(a):
        pass
    class c(b): 
        pass
    class d(c): 
        pass

and a file b.py:

    class e(b):
        pass

and I wanted to have a tree:

a-->b-->c->d
    |
    +-->e

I tried to use but I have this standard error:

(tmp_python) [usr@archlinux ~]$ epydoc -v --graph=classtree a.py b.py
Traceback (most recent call last):
  File "/home/seb/tmp_python/bin/epydoc", line 12, in <module>
    from epydoc.cli import cli
  File "/home/seb/tmp_python/lib/python3.10/site-packages/epydoc/cli.py", line 428
    print '\n' + msg.rstrip() + '\n'
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

1

There are 1 best solutions below

1
Mariener On

This looks like epydoc is not supporting python3. I just had the same problem. The error message is saying that the print statement was written in Python2.x syntax (parentheses missing). If you fix that, there will be more of those errors in the file though (I just tried). So it answers your question but does not solve the problem, sorry.