skillfed

importlab

A library to calculate python dependency graphs.

importlab v0.8.1 1.0M downloads/30d#4,489 on PyPI179
Permissive license Apache 2.0 Abandoned released

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 importlab

uv

uv add importlab

poetry

poetry add importlab

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development

Tags

python import dependency graphstatic analysis file orderingimport cycle detectionpython dependency inferenceimport graph analysis
static-analysisdependency-graphabandoned

More Software Development packages