A lightweight Python dependency analyzer that scans Python projects and visualizes import relationships.
- Scan Python projects for imported modules
- List project dependencies
- Generate File → Dependency trees
- Generate Dependency → File trees
- Detect unused imports
- Find files that import a specific dependency
- Show exact import lines for a dependency
- Filter dependencies by type:
- Standard Library
- Third-party
- Local
- Ignore files and directories during analysis
- Read ignore patterns from a file
- Export analysis results as JSON
- Use from the command line or as a Python library
- Support ASCII output for environments where Unicode tree characters are unavailable
pip install digdepList project dependencies:
digdep deps ./myprojectShow the File → Dependency tree:
digdep deps ./myproject --treeShow the Dependency → File tree:
digdep deps ./myproject --tree --reverseShow unused imports:
digdep deps ./myproject --unusedShow unused imports as a tree:
digdep deps ./myproject --unused --treeFind files importing a dependency:
digdep find-dep requests ./myprojectShow the dependency as a file tree:
digdep find-dep requests ./myproject --treeShow the exact import lines:
digdep find-dep requests ./myproject --tree --showlinesExport results as JSON:
digdep deps ./myproject --tree -o file_tree.jsonFor the complete CLI reference, see:
from digdep import DepAnalyzer
analyzer = DepAnalyzer()
analyzer.analyze("./myproject")
analyzer.show_deps()For the complete Python API guide, see:
📖 DigDep Library Documentation
Root (/projects/example)
├── main.py → requests, pathlib
├── config.py → json
│
├── modules/
│ ├── logger.py → logging
│ ├── parser.py → re, typing
│
└── utils/
└── helpers.py → functools
Dependency: ctypes
├── accessibleinfo.py
├── Line 1 : from ctypes import c_float
├── Line 2 : from ctypes import c_int
├── Line 3 : from ctypes import c_wchar
├── Line 4 : from ctypes import c_bool
├── Line 5 : from ctypes import Structure
├── Line 6 : from ctypes.wintypes import BOOL
├── Line 7 : from ctypes.wintypes import WCHAR
│
├── jabdriver.py
├── Line 5 : from ctypes import byref
├── Line 6 : from ctypes import CDLL
├── Line 7 : from ctypes import c_long
├── Line 8 : from ctypes.wintypes import HWND
│
| Guide | Description |
|---|---|
| README | Installation and quick start |
| docs/cli.md | Complete command-line reference |
| docs/api.md | DigDep library guide |
- Circular dependency detection
- Multiple output formats
- Performance improvements
- Python 3.11+
Released under the MIT License.