2.3.0 — Carta marina edition
New features
-
File exclusion (
-x/--exclude) — exclude files matching glob
patterns before analysis. Patterns without a path separator match
against the basename (e.g.test_*.py); patterns with a separator
match against the full path (e.g.*/tests/*). Available in both
call-graph and module-level modes, via CLI, Python API (exclude
parameter increate_callgraph/create_modulegraph), and the
Sphinx directive (:exclude:option, comma-separated).
(#119 — thanks @lightswitch05) -
Class-level constant attribute access — accessing class constants
(e.g.Color.REDon an Enum, orConfig.DEBUG) now creates a uses
edge to the class itself, so these classes no longer appear
disconnected in the graph. (#113) -
Sans-IO analysis via
from_sources—CallGraphVisitor.from_sources()
andcreate_callgraph(sources=...)accept(source_text, module_name)
pairs (or(ast.Module, module_name)) for analysis without any file
I/O. Useful for embedding pyan in tools that already have source text
in memory, or for analyzing ASTs from macro expanders.
(#101 — thanks @tristanlatr) -
Per-anonymous-scope isolation — multiple lambdas or comprehensions
in the same function no longer share a single scope. Each instance
now gets a numbered scope key (e.g.listcomp.0,listcomp.1),
preventing the second instance's bindings from overwriting the first's.
Works on both pre-3.12 (symtable-based) and 3.12+ (PEP 709 synthetic)
scope paths. (#110) -
Module-graph multi-project coloring — modules are now colored by
top-level directory relative to the project root, matching the
call-graph analyzer's approach. Previously, modules from different
projects could share colors if their immediate parent directories
had the same name. (#111) -
Class-prefixed method labels when ungrouped — when grouping is off,
method labels are now prefixed with the class name (e.g.MyClass.run
instead of justrun), making it possible to tell which class a method
belongs to without annotations. (#112)
Install: pip install pyan3==2.3.0
Full changelog: CHANGELOG.md