--- id: import-deps version: "0.5.1" license: MIT license_treatment: permissive maintenance: aging --- # import-deps — find python module imports License: permissive · Maintenance: aging · Downloads: 1.5M/mo ## 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 above — 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 pip install import-deps uv add import-deps poetry add import-deps ## Installing 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_current - Install friction: low - Maintenance: aging - Downloads: 1.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags python import analysis, static code imports, module dependencies, circular imports, ast import scanner, import visualization, code quality checks, code-quality, static-analysis [View on SkillFed](https://skillfed.io/packages/import-deps) · [View on PyPI](https://pypi.org/project/import-deps/)