import-deps
find python module imports
What it is and what it does
import_deps is a static import analyzer built on the ast module from the standard library that maps which modules import which other modules within a package, without executing any code. It works as both a CLI tool and a library, letting you discover direct and transitive import relationships, detect patterns like circular dependencies, re-imports, and inner imports, and visualize dependency graphs in DOT format.
The tool is designed for code quality workflows: you give it a set of Python files or a package directory, and it reports what each module imports from the others. It can output results as plain text, JSON, or a dependency graph, and includes checks useful for enforcing import patterns in CI/CD pipelines. It also supports topological sorting to order modules by their dependency depth.
Use it for:
- Detect circular dependencies in a package to identify and refactor problematic import cycles.
- Enforce import patterns by checking for re-imports or inner imports within a codebase.
- Visualize internal module dependencies as a graph for documentation or architecture review.
- Generate a topological sort of modules for build systems or dependency-aware execution order.
- Run checks in CI/CD pipelines to enforce consistent import style across a package.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Analyzes Python module imports statically using the ast module, without executing code, to map internal dependencies within a package or across files.
Yes, if you need static import analysis for code quality or architecture review within a single package. The tool is stable (MIT, no vulnerabilities, low install friction) and supports current Python versions. Install with caution if your project depends on frequent updates—maintenance is aging and the last release was 217 days ago, so it may lag behind new Python versions or edge cases.
Install
import-deps on PyPI
pip
pip install import-depsuv
uv add import-depspoetry
poetry add import-depsInstalling import-deps
Before you install
Low friction install with no runtime dependencies. Maintenance status is aging—last release was 217 days ago and the repository shows minimal recent activity, though it remains archived=false and supports current Python versions (3.10–3.14).
License in practice
MIT license is permissive; you may use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install import-deps
# CLI: analyze a package
import_deps foo/ --json
# Library: track imports within a module set
from import_deps import ModuleSet
module_set = ModuleSet(['foo/foo_a.py', 'foo/foo_b.py'])
for imp in module_set.mod_imports('foo.foo_a'):
print(imp)
Requires Python >=3.10; the package analyzes only imports within a known set of modules you provide, not external dependencies.
Verify before relying
- Whether the aging maintenance status (217 days since last release) affects reliability for new Python versions beyond 3.14.
- Performance characteristics on large codebases (the fact sheet does not specify scalability limits).
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 217 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,539,820/month — #3,788 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: import_deps-0.5.1-py3-none-any.whl
Keywords: graph, import, quality
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
py-import-cyclesDetects import cycles in Python projects by…
permissive · top 15,000 on PyPI
pyan3Pyan3 performs static analysis on Python source…
copyleft · top 15,000 on PyPI
importlabImportlab infers Python import dependencies and…
permissive · top 5,000 on PyPI
mo-importsProvides patterns to resolve circular module…
copyleft · top 15,000 on PyPI
tachTach enforces module boundaries, dependency…
permissive · top 5,000 on PyPI
aspy.refactor-importsParses, classifies, and manipulates Python…
permissive · top 15,000 on PyPI
pydepsVisualizes Python module dependencies as graphs…
permissive · top 15,000 on PyPI
pytest-archonPytest-archon lets you define and test…
permissive · top 15,000 on PyPI
cyclicDetects and reports cyclic relationships in a…
permissive · top 15,000 on PyPI
modulegraphmodulegraph analyzes Python module dependencies…
permissive · top 15,000 on PyPI