modulegraph2
A module import dependency graph for Python projects.
Decision gist · record as of 2026-08-14
Yes, if you need to programmatically analyze Python module dependencies. The package is stable, has no known vulnerabilities, installs easily, and supports current Python versions. The aging maintenance status (264 days since last release) is a minor concern for a mature library, but not a blocker unless you need active development or rapid bug fixes.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction installation with a pure-wheel distribution.
- Maintenance is aging—last release was 264 days ago and the repository shows infrequent recent activity—but the package is marked Production/Stable and supports current Python versions through 3.15.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2025-11-23 (264 days) · last repo commit 2026-01-25 · 15 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 129,321 downloads/mo, #11,674 on PyPI
Alternatives
Verify before relying
pip install modulegraph2
from modulegraph2 import ModuleGraph
graph = ModuleGraph()
graph.add_module('mypackage')
for node in graph.nodes():
print(node)- Whether the static analysis accurately handles dynamic imports, conditional imports, or complex import patterns in real-world codebases.
- Performance characteristics when analyzing large projects with hundreds or thousands of modules.
- Whether the rewrite from the original modulegraph maintains backward compatibility or introduces breaking changes for existing users.
What it is and what it does
Modulegraph2 is a library for building and analyzing the dependency graph between Python modules. It performs static analysis on both source code and bytecode to discover which modules import which others, and annotates each dependency with metadata from the import statement itself. The graph also includes information about packages, extensions, and their relationships, with links to distribution metadata for modules installed via pip.
The package is a complete rewrite of an earlier modulegraph project, built from scratch for Python 3 with full test coverage. It's useful for understanding module structure, detecting circular dependencies, or building tools that need to reason about import relationships in a codebase.
Use it for
- Analyze import dependencies in a Python project to detect circular imports or unused modules.
- Build tooling that needs to understand the module structure of a codebase for refactoring or optimization.
- Generate documentation or visualizations of how modules in a project depend on each other.
- Validate that a package's public API only imports from intended modules.
- Trace which installed distributions provide modules used by a given Python project.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to programmatically analyze Python module dependencies.
The package is stable, has no known vulnerabilities, installs easily, and supports current Python versions. The aging maintenance status (264 days since last release) is a minor concern for a mature library, but not a blocker unless you need active development or rapid bug fixes.
Install
modulegraph2 on PyPI
Before you install
Low friction installation with a pure-wheel distribution. Maintenance is aging—last release was 264 days ago and the repository shows infrequent recent activity—but the package is marked Production/Stable and supports current Python versions through 3.15.
Requires Python 3.10 or later.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install modulegraph2
from modulegraph2 import ModuleGraph
graph = ModuleGraph()
graph.add_module('mypackage')
for node in graph.nodes():
print(node)
Verify before relying
- Whether the static analysis accurately handles dynamic imports, conditional imports, or complex import patterns in real-world codebases.
- Performance characteristics when analyzing large projects with hundreds or thousands of modules.
- Whether the rewrite from the original modulegraph maintains backward compatibility or introduces breaking changes for existing users.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagestyping_extensionsobjectgraph |
| Maintenance | Aging 264 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 129,321 / month, #11,674 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Free Threading :: 3 - StableProgramming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Build ToolsTopic :: Software Development :: Libraries :: Python Modules |
Evidence: modulegraph2-2.3-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “module dependency introspection”
- modulegraph2Modulegraph2 builds and introspects a dependency graph of Python…
- stdlib-listProvides lists of Python standard library module names for Python…
- pkg-aboutRetrieves Python package metadata at runtime in a uniform way,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also modulegraph · objectgraph · depyf · graphlib · pydeps · altgraph · import-linter · grimp · funcsigs · graphiti-core