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.2.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.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: depsgraph-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 a3870948842be54458de4456126f1008298f406bfc65537eb9b94732a3ec0f19
MD5 81f2d575ebc2e0a4fb0aaa95c67f897c
BLAKE2b-256 9aa699996a719df0afff2ed182b940f6e71d637d6d187ebbdb206868c0ee4c78

See more details on using hashes here.

File details

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

File metadata

  • Download URL: depsgraph-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88cf76cb8385f55ef524344cd476832b786a4fcc3c99ace4ff6d3ebe529d4039
MD5 661967f0a27d4242e06915adc18f4c7f
BLAKE2b-256 3ff9f620d265029da071ef5ace5cac37d0e5f9b0fe929905aa16f928dc8e9e59

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