importlab
A library to calculate python dependency graphs.
What it is and what it does
Importlab is a library that analyzes Python source files to automatically infer their import dependencies and construct a dependency graph. It is designed primarily as a library for static analysis tools that need to process files in a specific order—ensuring each file's dependencies are analyzed before the file itself. The package includes cycle detection and ships with a command-line tool for inspecting import information.
The library depends only on networkx for graph operations and has low installation friction. However, the project is archived and abandoned, with no updates since 2024-05-03 and no active maintenance. While it remains functional for its original purpose, users should be aware that bugs will not be fixed and compatibility with future Python versions is uncertain.
Use it for:
- Integrate with static analysis tools to ensure files are processed in correct dependency order
- Detect circular imports in a Python codebase to identify problematic dependency patterns
- Generate import dependency graphs for visualization or documentation of project structure
- Determine optimal file processing order for batch analysis tools that work on one file at a time
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Importlab infers Python import dependencies and builds a dependency graph, enabling tools to process files in dependency order and detect import cycles.
Yes, if you need import graph analysis for a static analysis tool and can tolerate an unmaintained package. The library is stable and has no known vulnerabilities, but the abandoned status means no future updates or support. Suitable for projects that have already integrated it or need this specific functionality and can accept the maintenance risk.
Install
importlab on PyPI
pip
pip install importlabuv
uv add importlabpoetry
poetry add importlabInstalling importlab
Before you install
Low friction to install. The package is abandoned (last commit 2024-05-03, repository archived) and has not been updated in over a year, so expect no maintenance or bug fixes going forward.
License in practice
Licensed under Apache 2.0 (permissive), so you can use it freely in commercial and private projects without restriction, though you must include a copy of the license.
Quickstart
pip install importlab
import importlab.pyxref
graph = importlab.pyxref.ImportGraph(['myfile.py'])
for node in graph.OrderedNodes():
print(node)
Requires Python 3.6 or later. The package is archived and unmaintained, so compatibility with future Python versions is not guaranteed.
Verify before relying
- Whether the package works reliably with modern Python versions (3.10+) given its abandoned status
- Whether networkx dependency version constraints are compatible with current ecosystem versions
- Specific API surface and available methods beyond what the description excerpt documents
Package facts
| License | Apache 2.0 (permissive) |
| Python support | supports the current Python release (>=3.6.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — networkx |
| Maintenance | abandoned — 1,043 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 1,023,847/month — #4,489 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: importlab-0.8.1-py2.py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
py-import-cyclesDetects import cycles in Python projects by…
permissive · top 15,000 on PyPI
pipdeptreepipdeptree displays installed Python packages…
permissive · top 5,000 on PyPI
import-depsAnalyzes Python module imports statically using…
permissive · top 5,000 on PyPI
pydepsVisualizes Python module dependencies as graphs…
permissive · top 15,000 on PyPI
mo-importsProvides patterns to resolve circular module…
copyleft · top 15,000 on PyPI
cyclicDetects and reports cyclic relationships in a…
permissive · top 15,000 on PyPI
igraphigraph provides a Python interface to a…
copyleft · top 5,000 on PyPI
altgraphaltgraph constructs and analyzes graphs…
permissive · top 5,000 on PyPI
rainflowRainflow implements the ASTM E1049-85 rainflow…
permissive · top 15,000 on PyPI
objgraphObjgraph lets you visualize and explore Python…
permissive · top 5,000 on PyPI