https://github.com/davidfstr/pydeps
Visualizes Python module dependencies.
https://github.com/davidfstr/pydeps
code-analysis python
Last synced: 2 months ago
JSON representation
Visualizes Python module dependencies.
- Host: GitHub
- URL: https://github.com/davidfstr/pydeps
- Owner: davidfstr
- Created: 2012-10-30T02:32:01.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-02-10T02:45:15.000Z (over 12 years ago)
- Last Synced: 2025-04-18T20:05:23.973Z (2 months ago)
- Topics: code-analysis, python
- Language: Python
- Homepage:
- Size: 199 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pydeps
Visualizes dependencies between Python modules.
## Usage
Just run the `pydeps.py` command with a path to a directory containing Python source files.
```
python pydeps.py ~/Projects/CPM/src output.dot
```The output is a `.dot` file, which can be rendered with [GraphViz].
And marvel as your program's modules and their dependencies become visible:
## Output Notes
* Nodes are Python modules. Edges are `imports` from one module to another.
* Edge thickness is proportional to the number of imports.
* Therefore the thickness approximates the amount of coupling between adjacent modules.
* Dashed edges (*not depicted*) denote an import that is outside the top-level.
* Such imports inside functions are typically used when creating a circular dependency.
* Conditional imports at the top level are also displayed in this manner.
* Yellow modules contain a main function (via the idiom `if __name__ == '__main__':`).
* Since modules with main functions are typically standalone programs or commands,
it's a good idea to avoid depending on them.
* System modules are excluded from the graph.
* A system module is defined as any module which resides outside the specified source directory.## Advanced Usage
A small number of command-line options are also supported:
Option
Description
Example
-i, --ignore-modules
Comma-separated list of modules to omit from the output graph.
crystal.xthreading, crystal.xfutures
## Fun Ideas
* Create an animated history of your program's growth over time:
* Write a program that checks out each revision of your program,
runs `pydeps.py`, and uses the `dot` tool to generate an image.## Requirements
* Python 2.7
* Earlier versions probably work too, but I haven't tested them.
* [GraphViz] — to render the output `.dot` files[GraphViz]: http://www.graphviz.org