Analyze Python dependencies, architecture, and import startup cost
Project description
importy
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 mapimporty loops- circular importsimporty doctor- health summaryimporty trace- why imported / who imports itimporty cost- startup import timingimporty lazy- lazy import suggestionsimporty dead- dead import detectionimporty 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:
- Onboarding into unfamiliar projects quickly
- Debugging architecture tangles
- Refactoring with confidence
- Reducing startup and cold-start costs
- Keeping architecture visible as projects grow
Notes
- Classification (
local,third_party,stdlib) depends on the interpreter environment. costexecutes 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.
mapis 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
importyversion- 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
mapwith concurrent file parsing
0.1.0
- Initial public release with dependency graph, cycle detection, doctor summary, trace/why, and import timing
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
578b89fa96f2639c742b1e71a32ae7ed51122846fdddaa6e4cd9b69c7cab7000
|
|
| MD5 |
84d13ca20a67625ccb99e6739fa7ff8e
|
|
| BLAKE2b-256 |
aff35d128f665d667312cb137d692637a85ea42d65fb0f27d952a67fc4835e68
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f78e89d9ee42b3085775500cd8fbe6dcbe2d02dff24a9547b55e52558c339bd5
|
|
| MD5 |
f37e3493370565fa40c69b25cab982e2
|
|
| BLAKE2b-256 |
9aeb96813f8775f2bea54fbe91fe735192931116eac5c220e413e8720fb43dea
|