Skip to main content

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

Metadata

Release files for importy 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for importy 0.1.1
File Size Uploaded Provenance Actions
importy-0.1.1.tar.gz 15.5 kB Without provenance Details for importy-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for importy 0.1.1
File Interpreter ABI Platform Actions
importy-0.1.1-py3-none-any.whl Python 3 none any Details for importy-0.1.1-py3-none-any.whl

Total release size: 29.1 kB

Release files / importy-0.1.1.tar.gz

Download URL importy-0.1.1.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
578b89fa96f2639c742b1e71a32ae7ed51122846fdddaa6e4cd9b69c7cab7000
BLAKE2b-256 checksum
How to use checksums
aff35d128f665d667312cb137d692637a85ea42d65fb0f27d952a67fc4835e68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / importy-0.1.1-py3-none-any.whl

Download URL importy-0.1.1-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f78e89d9ee42b3085775500cd8fbe6dcbe2d02dff24a9547b55e52558c339bd5
BLAKE2b-256 checksum
How to use checksums
9aeb96813f8775f2bea54fbe91fe735192931116eac5c220e413e8720fb43dea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for importy 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page