Skip to main content

Visualize Python import graphs

Project description

importy

PyPI Version Python Versions License Status Downloads (Month) Downloads (Total)

importy is a Python CLI that makes import dependencies visible.

It statically analyzes .py files, builds a dependency graph, highlights architecture risks, and can profile real import startup time.

Why use it

  • See what your code actually depends on
  • Understand unfamiliar projects faster
  • Catch circular dependencies early
  • Find refactor hotspots (high fan-out/hub modules)
  • Profile import startup cost in milliseconds

Visual preview

Graph mode

╭─ pyimports summary ─╮
│ Files        27     │
│ Imports      132    │
│ Local        41     │
│ Stdlib       28     │
│ Third-party  6      │
│ Unresolved   57     │
╰─────────────────────╯
app\main.py
├── app.api.main (local)
├── app.core.config (local)
├── fastapi (third_party)
└── sentry_sdk (third_party)

Doctor mode

╭──── pyimports doctor ────╮
│ Dependency health report │
╰──────────────────────────╯
High: No local circular dependencies detected
Medium: 57 unresolved imports across 23 files
Info: Most used third-party imports
Suggestion: Files with high dependency fan-out
Architecture: Top directory layers in scan

Installation

pip install importy

For development:

pip install -e .[dev]

Commands

graph

Scan a file or directory and print dependency tree or JSON.

importy graph path/to/file_or_dir
importy graph path/to/dir --format json
importy graph path/to/app --project-root path/to/repo_root

cycles

Detect circular local dependencies.

importy cycles path/to/dir --project-root path/to/repo_root

cycle is also supported as an alias.

doctor

Print a prioritized dependency health report.

importy doctor path/to/dir --project-root path/to/repo_root

why

Find who imports a module.

importy why app.models path/to/dir --project-root path/to/repo_root

time

Profile real import startup cost with Python -X importtime.

importy time path/to/entry.py --top 20

Notes on accuracy

  • local / third_party classification depends on interpreter environment.
  • Use --project-root for monorepos or nested app layouts.
  • time runs real imports and requires target dependencies installed.

Roadmap

  • doctor --json for CI integration
  • Better local-path resolution in graph tree annotations
  • Layering policy checks (example: api -> service -> db)
  • Lazy import suggestion mode

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

importy-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

importy-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file importy-0.1.0.tar.gz.

File metadata

  • Download URL: importy-0.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for importy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a56e2d2130e6d150f4630aec76b1f24bf795980a9cdda35ad6650ee3dd7a8a3
MD5 e379312e9b3443251b137f09d3efd2a3
BLAKE2b-256 5787900c74fe99a28c4d2df5837191581f7276ebd928b6d1a07f0d5e646e2ecf

See more details on using hashes here.

File details

Details for the file importy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: importy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for importy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86d92adc868e920721d59514f7ccd4c03c2a8ff1cce57a29d0286150c73fa0fe
MD5 7712a0e8dc4b2caad0359bbd608fd037
BLAKE2b-256 2f2dbb47abf09836c9708d147a50193c93c89cdb4515030014565d699bb9aabc

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