How technologicat/pyan works
Pyan3 is an offline Python static-analysis tool: a user supplies source files through the CLI or Python API, the analyzer builds a graph of definitions and uses, and the tool emits a visual or text representation. A separate module-level mode analyzes import dependencies and detects cycles. The graph model, postprocessing, and rendering form the principal internal layer; documented filtering, path queries, and Sphinx integration are represented without assuming details of unsampled implementations. Relationships are limited to README statements and sampled source references.
Main entry points: main.py CLI and API · analyzer.py AST analysis · callgraph.py Call graph state · visgraph.py Visual graph
Components 16
Inputs and entry points
- Python sources
- CLI and API
pyan/main.py
Static analysis
- AST analysis
pyan/analyzer.py - Anonymous scopes
pyan/anonscopes.py - Pattern recognizers
pyan/recognizers.py - Analysis utilities
pyan/anutils.py - Import analysis
pyan/modvis.py
Graph processing
- Call graph state
pyan/callgraph.py - Graph nodes
pyan/node.py - Graph postprocessing
pyan/postprocessor.py - Graph queries
pyan/callgraph.py
Output and integrations
- Visual graph
pyan/visgraph.py - Format writers
pyan/writers.py - Graph output
- Sphinx integration
pyan/sphinx.py
Other components
- User
Connections 17
- User → CLI and API: invokes
README.md - Python sources → CLI and API: provides inputs
README.md - CLI and API → AST analysis: runs analysis
pyan/main.py - CLI and API → Import analysis: dispatches mode
pyan/main.py - AST analysis → Anonymous scopes: uses scope plans
pyan/analyzer.py - AST analysis → Pattern recognizers: uses recognizers
pyan/analyzer.py - AST analysis → Analysis utilities: uses utilities
pyan/analyzer.py - AST analysis → Call graph state: populates graph
pyan/analyzer.py - Call graph state → Graph nodes: stores nodes
pyan/callgraph.py - AST analysis → Graph postprocessing: postprocesses graph
pyan/analyzer.py - Call graph state → Graph queries: supports queries
pyan/callgraph.py - CLI and API → Visual graph: prepares output graph
pyan/main.py - Visual graph → Graph nodes: labels nodes
pyan/visgraph.py - CLI and API → Format writers: selects writer
pyan/main.py - Visual graph → Format writers: provides graph
- Format writers → Graph output: emits formats
README.md - CLI and API → Sphinx integration: supports integration
README.md