https://github.com/sizhky/source-view
(Basic) Functionality to view a python library as a graph
https://github.com/sizhky/source-view
bokeh call-graph call-graph-analysis dac graph library-management networkx python torch-snippets
Last synced: 16 days ago
JSON representation
(Basic) Functionality to view a python library as a graph
- Host: GitHub
- URL: https://github.com/sizhky/source-view
- Owner: sizhky
- License: mit
- Created: 2021-11-23T11:30:03.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-10-30T03:42:43.000Z (7 months ago)
- Last Synced: 2025-10-30T05:42:14.002Z (7 months ago)
- Topics: bokeh, call-graph, call-graph-analysis, dac, graph, library-management, networkx, python, torch-snippets
- Language: HTML
- Homepage:
- Size: 1.18 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# source-view
(Basic) Functionality to view a python library as a graph
The main purpose of this utility is to view a library from bird's eye view without touching the codebase in anyway. Having a quick understanding of the dependecies and files will help one to get a feel of the code base.
## Usage
```bash
$ python source_view.py ~/Documents/github/torch_snippets/torch_snippets/`
```
This would generate a file called as `torch_snippets.html` at `~/Documents/github/torch_snippets/torch_snippets/`
Download [torch_snippets.html](examples/torch_snippets.html) to see it interactive. This graph was generated for [torch-snippets](https://github.com/sizhky/torch-snippets)
library. Feedback solicited on your own libraries as well. I have not tested it on complex libraries.

Legend:
* Red: File
* Purple: Class
* Green: Function
* Yellow: Other functions/dependencies
## Performance
The bottleneck is to generate graph layout for the entire source. I have tested with a few libraries and is slow for medium size. For example it took 3m 17s to render graph for scrapy which contained 4239 nodes and 7600 edges.
IMO this is best for analyzing library with under 20 files.
I ran some more examples and have uploaded them in [examples](examples) folder