Skip to main content

DigDep

Version PyPI version Python versions License Status Open Source

A lightweight Python dependency analyzer that scans Python projects and visualizes import relationships.


Features

  • 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

Installation

pip install digdep

Quick Start

Command Line

List project dependencies:

digdep deps ./myproject

Show the File → Dependency tree:

digdep deps ./myproject --tree

Show the Dependency → File tree:

digdep deps ./myproject --tree --reverse

Show unused imports:

digdep deps ./myproject --unused

Show unused imports as a tree:

digdep deps ./myproject --unused --tree

Find files importing a dependency:

digdep find-dep requests ./myproject

Show the dependency as a file tree:

digdep find-dep requests ./myproject --tree

Show the exact import lines:

digdep find-dep requests ./myproject --tree --showlines

Export results as JSON:

digdep deps ./myproject --tree -o file_tree.json

For the complete CLI reference, see:

📖 CLI Documentation


DigDep Library

from digdep import DepAnalyzer

analyzer = DepAnalyzer()
analyzer.analyze("./myproject")

analyzer.show_deps()

For the complete Python API guide, see:

📖 DigDep Library Documentation


Example Output

File → Dependency Tree

Root (/projects/example)

├── main.py              → requests, pathlib
├── config.py            → json
│
├── modules/
│   ├── logger.py        → logging
│   ├── parser.py        → re, typing
│
└── utils/
    └── helpers.py       → functools

Find Dependency

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
    │

Documentation

Guide Description
README Installation and quick start
docs/cli.md Complete command-line reference
docs/api.md DigDep library guide

Roadmap

  • Circular dependency detection
  • Multiple output formats
  • Performance improvements

Requirements

  • Python 3.11+

License

Released under the MIT License.

Release files for digdep 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for digdep 0.1.1
File Size Uploaded
digdep-0.1.1.tar.gz 15.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for digdep 0.1.1
File Interpreter ABI Platform
digdep-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 32.8 kB

Release files / digdep-0.1.1.tar.gz

Download URL digdep-0.1.1.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3c74b35662c395236836ae2b964a8775f6a2fe7da02b1d3d089920abc1bae140
BLAKE2b-256 checksum
How to use checksums
e01460699c016772c7fb7688619559f3d642750b62d7494857729fa158d4b21e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / digdep-0.1.1-py3-none-any.whl

Download URL digdep-0.1.1-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75b7c23e5cb994567f15fe0a68e99563123bf3e94841bb92a4911f909d528bd0
BLAKE2b-256 checksum
How to use checksums
b2294a3f78b32eb3e32a858b7bf6491e64bfd25d3e689dd3f54d628f29751831
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page