Releases: Technologicat/pyan
Releases · Technologicat/pyan
Version 1.2.0
Starting with this release, Pyan is now jointly maintained by @Technologicat, @jdb78, and @johnyf.
New:
- Sphinx extension.
Changed:
- Improve package root resolution.
Fixed:
- #62:
visit_AnnAssign
crash on an empty list.
Version 1.1.1
Version 1.0.4
Bugfix release: fix #7, #8, #9.
Thanks to @matt-kempster and @fcabaud for bug reports!
Version 1.0.3
Packaged with setuptools and uploaded to PyPI.
Script name is now pyan3
.
Pyan3 v1.0.2
Bugfix:
- fix regression: keep wildcard if the 'resolved' target is actually an unresolved function argument
Enhancements:
- add
--grouped-alt
(-G
) to make invisible defines edges to suggest grouping for GraphViz, without actually placing the nodes into GraphViz clusters. Overrides--no-defines
. Overridden by--defines
. - analyze
str()
andrepr()
if the argument is a Name or Attribute mapping to a known Node. - add uses edge to result from a resolved call to built-ins, important for
str()
andrepr()
Pyan3 v1.0.1
Bugfixes:
- crash in analyzer when resolving
super()
call with no known bases - crash in
collapse_inner()
during postprocessing - use
/usr/bin/env python3
instead of hard-coded/usr/bin/python3
in hashbang inpyan.py
to support virtualenvs correctly
Enhancements:
- analyze the
with
statement: add uses edges from the node containing thewith
block to__enter__
and__exit__
methods of thewith
'd object; also track binding fromwith ... as foo
(single target only for now, and__enter__
is assumed toreturn self
) - analyze instantiation: add a uses edge to
MyClass.__init__
for a call toMyClass()
- node flavoring both in analysis and in output (class, function, method, staticmethod, classmethod)
- figure out which names correspond to arguments in FunctionDef; prevent leakage of matching names from the enclosing scope. This fixes some spurious edges.
- avoid adding a uses wildcard when resolving
super()
fails. This fixes spurious, possibly seemingly recursive, uses edges in the case that part of the class hierarchy is not available for analysis. (The most common reasons forsuper()
resolution to fail are that either the analyzer is still running pass 1 [MRO is computed between passes], or some relevant source file is not in the analyzed set.)
Technical improvements:
- refactor analyzer: split into the main class and
anutils
- reorder methods in the analyzer main class to make the source code more logical to read for humans
Pyan3 v1.0.0
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
andsymtable
- 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 swapa,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