14

How do I graph module dependencies in Python 3? I found snakefood, but it seems to only work with Python 2.

Neil G
  • 30,493
  • 34
  • 149
  • 247

3 Answers3

9

I presume you are talking about this snakefood, available on PyPI, though not not updated there since 2009. Since it is an application intended to be run, rather than just a library of modules intended to be imported, you can execute it with Python 2.7 even if the target is a directory of Python 3 modules. It could be run from either 2.x or 3.x with subprocess. Its output files can be read equally well with any Python.

I cloned it with hg clone --insecure <src> <dest>. My preliminary experiments indicate that very little change would be needed to run it with 3.x. I just needed the following in 2 of the 4 biggest files to get them to compile.

  • print x => print(x)
  • except XError, e: => except XError as e:
Terry Jan Reedy
  • 17,284
  • 1
  • 38
  • 50
8

I built a tool based on pydeps here.

Neil G
  • 30,493
  • 34
  • 149
  • 247
2

python3 dependency graphs generator

https://github.com/Trim21/snakefood3

I had the same question 3 years ago, so I forked snakefood and fixed it for Python 3.

ShoeLace
  • 3,210
  • 2
  • 27
  • 44
Trim21
  • 21
  • 1
  • 2