skillfed

import-deps

find python module imports

import-deps v0.5.1 1.5M downloads/30d#3,788 on PyPI25
Permissive license MIT AGING released

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-deps

uv

uv add import-deps

poetry

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 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Quality Assurance

Tags

python import analysisstatic code importsmodule dependenciescircular importsast import scannerimport visualizationcode quality checks
code-qualitystatic-analysis

More Quality Assurance packages