Skip to content

Pyan3 v1.0.0

Compare
Choose a tag to compare
@Technologicat Technologicat released this 21 Nov 11:23
· 176 commits to master since this release

Python 3 compatibility.

Changes w.r.t. the long-standing version of Pyan for Python 2, davidfraser/pyan@26faced :

  • rewrite analyzer in Python 3, using ast and symtable
  • unlimited number of hues for output graph nodes
  • graph node hue is now based on filename, not top-level namespace
  • detailed (debug) logging with --very-verbose, can be abbreviated to -V
  • treat __init__ like any method (now shows up in the output graph)
  • add uses edges for recursive calls
  • analyze nested class definitions
  • define "self" by capturing the name of the first argument of methods and class methods, like Python does
  • analyze nested attribute accesses (e.g. self.a.b)
  • look up inherited attributes (using MRO with C3 linearization, based on static type at use site)
  • analyze super() calls
  • recognize for as a binding form to avoid name clashes between loop counters and functions defined elsewhere (however, can fail if the expression to be assigned is complex enough)
  • analyze simple item-by-item tuple assignments x,y,z = a,b,c and pythonic swap a,b = b,a
  • analyze chained assignments a = b = c
  • in analysis, use local scope for lambda, listcomp, setcomp, dictcomp, genexpr to follow Python 3 scoping rules correctly; for visualization, contract these into the parent node in postprocessing
  • yEd GraphML output support, framework for easily adding new output formats (merge PR #1 from davidfraser/pyan)
  • bugfix for unsafe graph node identifiers, fix inspired by davidfraser/pyan@ddb62d2
  • refactor code into modules for easier maintenance