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.4.tar.gz (5.6 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.4-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: depsgraph-0.1.4.tar.gz
  • Upload date:
  • Size: 5.6 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.4.tar.gz
Algorithm Hash digest
SHA256 64cccb538a9a0a78225a519e0fe2ab19ac73470666c3dc3402b28b3420f64f12
MD5 18ae25236a90bea20a73abda2028da4c
BLAKE2b-256 a5c5f9aa7528789661ad5f6469e29270730edfa86d8fc9e5ab9178114a86582b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: depsgraph-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 969a124ba4ae05513b714de139fff47ee9cb2831171b10b2b555ea9d3316dc89
MD5 1e73b3656aca911f25ba4597f457bbc9
BLAKE2b-256 e39b227ad8c0cc20203eb394b59fa9bd5a9aa16da5590cfaf0996fdd6f3a2ae4

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