skillfed

pyan3

Generate approximate call graphs for Python programs

pyan3 v2.6.2 204.2K downloads/30d#9,615 on PyPI445
Copyleft license GPL-2.0-or-later Active released

What it is and what it does

Pyan3 reads Python source files and builds a directed graph of how functions, classes, and modules relate to each other through calls and definitions. Unlike runtime profilers, it performs static analysis by examining code structure rather than executing it, making it useful for understanding architecture without running the code. The tool outputs graphs in multiple formats—GraphViz DOT, yEd, SVG, HTML, or plain text—and supports filtering by depth, direction, and import cycles. It also performs module-level dependency analysis to detect circular imports.

The package was recently revived in February 2026 with support for modern Python syntax (walrus operators, match statements, async with, type aliases) across Python 3.10–3.14. It includes a comprehensive test suite and offers both a command-line interface and a Python API for programmatic use. The single runtime dependency is jinja2, keeping the install footprint minimal.

Use it for:

  • Visualize call graphs for code review or documentation by generating SVG diagrams of function relationships.
  • Detect circular import dependencies at the module level to identify architectural problems.
  • Generate plain-text call graphs to feed into coding AI agents or documentation systems.
  • Analyze codebase structure without executing it, useful for security audits or understanding unfamiliar projects.
  • Control graph detail with depth filtering to create high-level architecture overviews or drill down to specific functions.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Pyan3 performs static analysis on Python source code to generate call graphs showing how functions, classes, and modules use each other, with output to GraphViz, yEd, or plain text.

Yes, if you need static call-graph visualization or dependency analysis. The package is actively maintained, supports current Python versions, has low install friction, and offers both CLI and API modes. The copyleft GPL-2.0-or-later license is a consideration only if you plan to redistribute derivative code commercially. No known vulnerabilities.

Install

pyan3 on PyPI

pip

pip install pyan3

uv

uv add pyan3

poetry

poetry add pyan3

Installing pyan3

Before you install

Low install friction with a single runtime dependency (jinja2). The project is actively maintained as of February 2026, recently revived with modernized analyzer and comprehensive test coverage, supporting Python 3.10–3.14.

License in practice

Licensed under GPL-2.0-or-later (copyleft). You may use and modify the package freely, but any derivative work distributed must also be open-source under a compatible GPL license.

Quickstart

pip install pyan3

pyan3 src/ --dot --colored --no-defines --concentrate --file output.dot
dot -Tsvg output.dot -o output.svg

Requires Python 3.10 or later. GraphViz must be installed separately to render DOT output to SVG/PNG.

Verify before relying

  • Whether the 200+ test suite and 91% branch coverage claim applies to the current 2.6.2 release or is aspirational.
  • Performance characteristics on large codebases (e.g., thousands of files or deeply nested packages).
  • Accuracy of static analysis for dynamic imports, eval, or __import__ patterns.

Package facts

License GPL-2.0-or-later (copyleft)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — jinja2
Maintenance actively maintained — 31 days since the last release
Last repo commit
First released
Downloads 204,166/month — #9,615 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyan3-2.6.2-py3-none-any.whl

Keywords: call-graph, static-code-analysis, code-visualization, dependency-analysis

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software DevelopmentTopic :: Software Development :: Libraries :: Python Modules

Tags

call graph generator pythonstatic code analysis visualizationpython dependency graphfunction call relationship mappercode structure analyzerimport cycle detectionpython ast analysis tool
code-analysisvisualizationstatic-analysis

More Software Development packages