
Pydescope is a static analysis tool designed to help developers visualize the internal structure and dependencies of their Python projects. By parsing source code and mapping imports, it generates interactive 2D/3D graphs using NetworkX and PyVis, allowing you to see how different modules interact without the clutter of virtual environments or external libraries.

pydescope/
├── .gitignore # Standard git ignore rules
├── pyproject.toml # Build system and dependency configuration
├── README.md # Project documentation
├── CONTRIBUTING.md # Contributing documentation
├── LICENSE.md # License documentation
├── pydescope/ # Core logic package
│ ├── __init__.py # Package initialization
│ ├── analyzer.py # Logic for parsing imports and code analysis
│ ├── graph_builder.py # NetworkX graph construction
| ├── parser.py # Identifes .py files in projects
│ ├── renderer.py # PyVis conversion and HTML generation
│ └── utils.py # Internal helper functions
| └── cli.py # User interaction tool
└── lib/ # Static assets for the final output
└── bindings/
└── utils.js # Custom JS for highlighting and interactivity
parser.py: The engine that walks through your project and identifies Python files.
analyser.py: Scans individual files to extract import statements and determine relationships.
graph_builder.py: Uses NetworkX to create a mathematical representation of the project dependency tree.
renderer.py: Converts the NetworkX graph into an interactive PyVis HTML file.
cli.py: Provides the Command Line Interface for users to interact with the tool.
Clone your repository (or navigate to the project folder):
cd pydescope
This installs the dependencies and allows you to run the pydescope command directly.
pip install -e .
Once installed, you can run Pydescope from your terminal.
Point Pydescope at any Python project directory you want to analyze:
pydescope <path_to_target_project>
Command Options
Output Name: Specify a custom name for your HTML report.
pydescope <path_to_project> --output my_graph.html
Exclude Directories: Although it ignores venv by default, you can add more exclusions.
pydescope <path_to_project> --exclude tests,docs
Visualisation Controls
The generated HTML file includes advanced JavaScript-based controls located in the lib/bindings/utils.js file: