Skip to main content

Visualize internal Python import dependencies

Project description

depsgraph is a minimal command-line tool that shows which Python modules a single file depends on within your project. It ignores stdlib and third-party imports by default, so you see only your own code’s coupling.

Features

  • Static analysis via AST (fast, no imports executed)
  • ASCII tree printed to stdout
  • Mermaid mindmap generated as .mmd and self-contained .html
  • Configurable recursion depth and ignore patterns
  • Detects import cycles and marks them

Install

pip install depsgraph

Usage

depsgraph path/to/file.py --project-dir /path/to/project

Example:

$ depsgraph src/handlers/api.py --project-dir . src/handlers/api.py +-- src/models/user.py +-- src/utils/auth.py | +-- src/config.py +-- src/db/conn.py +-- src/config.py

The command also creates deps_graph.html in the project directory; open it in a browser to view an interactive Mermaid mindmap.

Options

  • --project-dir: root of the project to scan (default ".")
  • --max-depth: limit graph depth (default 50)
  • --show-missing: list unresolved imports (stdlib, missing files)
  • --no-mermaid: skip Mermaid file generation
  • --ignored-dir: repeatable, e.g. --ignored-dir generated

Requirements

Python 3.9+

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

depsgraph-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

depsgraph-0.1.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file depsgraph-0.1.1.tar.gz.

File metadata

  • Download URL: depsgraph-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for depsgraph-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9f1545df4011e947ba2622a585552903ee83a8ad74bfdef17a3d778243cd9537
MD5 49ba578cae4f867a643d4a2c681456a9
BLAKE2b-256 d023f17b469e86a8c2756e10e1840879ca6c17a23707fca7e40f4b53b247d088

See more details on using hashes here.

File details

Details for the file depsgraph-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: depsgraph-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for depsgraph-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99496f6f30a4480d15156221a1e04058ad3abbf2af67d34014f8efdda596232b
MD5 888fd003c0aa232bf0f55b8f802ec71d
BLAKE2b-256 7ea4dffc361a91b21557063ff4200977459f7de580a7ff4614420ccc182d0bcd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page