codegrapher
Code that graphs code
Uses the python AST to parse Python source code and build a call graph.
Output
An example of the current output of the parser parsing itself.
Installation
pip install codegrapher
To generate graphs, graphviz must be installed.
Usage
At the command line
To parse a file and output results to the console:
codegrapher path/to/file.py --printed
To parse a file and output results to a file:
codegrapher path/to/file.py --output output_file_name --output-type png
To analyze a directory of files, along with all files it contains:
codegrapher -r path/to/directory --output multiple_file_analysis
And if you have a list of functions that aren’t useful in your graph, add it to a .cg_ignore file:
# cg_ignore file # all lines beginning with '#' are ignored # every function calls this, so it's not helpful in my graph: log_error # I don't want to see this in my graph: parse lower
Then add the –ignore flag to your command. Using the flag –remove-builtins provides the same functionality for ignoring items found in __builtins__.
As a Python module
To easily parse code in Python :
from codegrapher.parser import FileObject
file_object = FileObject('path/to/file.py')
file_object.visit()
And then to add that code to a graph and render it (using graphviz):
from codegrapher.graph import FunctionGrapher
graph = FunctionGrapher()
graph.add_file_to_graph(file_object)
graph.name = 'name.gv'
graph.format = 'png'
graph.render()
Which will produce your code as a png file, name.gv.png, along with a dot file name.gv
More documentation for the Python module can be found at Read the Docs.
Metadata
Release files for codegrapher 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| codegrapher-0.3.0.tar.gz | 56.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| codegrapher-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.1 kB
Release files / codegrapher-0.3.0.tar.gz
| Download URL | codegrapher-0.3.0.tar.gz |
|---|---|
| Size | 56.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46ec21fc5398438f27a7112ef957d66eadbf3aeaea8a334722fcfccb95c7ad6a
|
|
BLAKE2b-256 checksum How to use checksums |
995be82d497a79e8e05b88a00137fd062de0d5db468060bcabc957c91a278fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2026.
Transparency logRelease files / codegrapher-0.3.0-py3-none-any.whl
| Download URL | codegrapher-0.3.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a82ef9aad5dce3c666b7eb017adc30e2d51aef93d1733e53f227b80e76f6bb44
|
|
BLAKE2b-256 checksum How to use checksums |
eb20dc197259c149d743bde592a0a8cb298501341a2a6dcb345b871cb38b2408
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2026.
Transparency logSecurity for codegrapher 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for codegrapher-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.