PyCG is a tool for generating call graphs for Python code using static analysis. It produces call graphs in JSON format and supports Python >=3.4. The current version on PyPI is 0.0.8. Development is relatively low activity; last commits on GitHub appear to be from 2022. The primary use case is understanding static call relationships in Python programs.
pip install pycgVerified import paths — ran on the pinned version, not inferred.
Basic usage to generate a JSON call graph for a Python file. Note that pycg expects a list of file paths and a package name.
Pass the module name (the name you would use in imports, e.g., 'myscript' for myscript.py).
Use pycg as a supplementary tool; combine with runtime tracing for full coverage.
Consider using alternatives like `pyan` or `code2flow` for better Python 3.10+ support.
No dependency data recorded yet.