Skip to main content

Analyze Python dependencies, architecture, and import startup cost

Project description

importy

PyPI Version Python Versions License Status Open Source Downloads (Total) GitHub

importy is a Python CLI for understanding import relationships, architecture, and startup cost.

It gives you practical answers to questions like:

  • "What is my code actually depending on?"
  • "Why is this imported?"
  • "Can I delete this module safely?"
  • "What imports are slowing startup?"

Features

  • Dependency graph mapping
  • Circular import detection
  • Startup cost analysis
  • Lazy import suggestions
  • Dead import detection
  • Architecture flow visualization
  • "Why is this imported?" tracing

Install

pip install importy

Source code: github.com/theveryheavy/importy

Command UX

The primary command names are short and memorable:

  • importy map - dependency map
  • importy loops - circular imports
  • importy doctor - health summary
  • importy trace - why imported / who imports it
  • importy cost - startup import timing
  • importy lazy - lazy import suggestions
  • importy dead - dead import detection
  • importy arch - architecture flow map

Backward-compatible aliases still work (graph, cycles, why, time).

Quick examples

Map unfamiliar project structure:

importy map .

Inspect cycles:

importy loops .

Trace who imports auth/services/helpers:

importy trace auth .
importy trace services .
importy trace helpers .

Refactoring safety check:

importy trace helpers.py .
importy dead .

Startup import performance:

importy cost app.py --top 20

Architecture view:

importy arch .

Project health (great for onboarding and reviews):

importy doctor .

Working with monorepos / nested apps

Use --project-root when your scan path is inside a larger repo:

importy map backend/app --project-root backend
importy doctor backend/app --project-root backend

Why this is useful

importy is designed for practical engineering work:

  1. Onboarding into unfamiliar projects quickly
  2. Debugging architecture tangles
  3. Refactoring with confidence
  4. Reducing startup and cold-start costs
  5. Keeping architecture visible as projects grow

Notes

  • Classification (local, third_party, stdlib) depends on the interpreter environment.
  • cost executes imports for real and requires dependencies installed.
  • Dead import detection is static analysis and can have edge cases with dynamic usage patterns.
  • Files with syntax errors are skipped and reported as parse-error info rows instead of crashing commands.
  • map is optimized for large repositories with concurrent scanning and a fast import-only parse path.

Issues & Feedback

Found a bug, incorrect analysis, false positive, or have a feature idea?

Please open an issue on GitHub:

👉 https://github.com/theveryheavy/importy/issues

Good issue reports help improve importy much faster. If possible, include:

  • Python version
  • Operating system
  • importy version
  • Minimal reproducible example
  • Expected behavior
  • Actual behavior

Feature requests, architecture ideas, and performance suggestions are also welcome.

Changelog

0.1.1

  • Renamed and streamlined command UX (map, loops, trace, cost, lazy, dead, arch)
  • Added architecture flow view and improved tracing output
  • Added lazy import suggestions and dead import detection
  • Improved startup cost error messaging and table rendering polish
  • Added parse-error resilience across analysis commands (map, lazy, dead)
  • Improved large-repo performance for map with concurrent file parsing

0.1.0

  • Initial public release with dependency graph, cycle detection, doctor summary, trace/why, and import timing

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.1.tar.gz (15.5 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.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: importy-0.1.1.tar.gz
  • Upload date:
  • Size: 15.5 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.1.tar.gz
Algorithm Hash digest
SHA256 578b89fa96f2639c742b1e71a32ae7ed51122846fdddaa6e4cd9b69c7cab7000
MD5 84d13ca20a67625ccb99e6739fa7ff8e
BLAKE2b-256 aff35d128f665d667312cb137d692637a85ea42d65fb0f27d952a67fc4835e68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: importy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f78e89d9ee42b3085775500cd8fbe6dcbe2d02dff24a9547b55e52558c339bd5
MD5 f37e3493370565fa40c69b25cab982e2
BLAKE2b-256 9aeb96813f8775f2bea54fbe91fe735192931116eac5c220e413e8720fb43dea

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