py-import-cycles
Detect import cycles in Python projects
Decision gist · record as of 2026-08-14
Yes, if you need to detect import cycles in Python projects. The tool is actively maintained, has no known vulnerabilities, and imposes minimal install friction. It's most useful for developers doing code reviews, refactoring, or enforcing architectural standards. Not necessary if your project already uses a linter or type checker that catches circular imports, or if import cycles aren't a concern in your workflow.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.12 or later; graphviz and networkx must be available at runtime.
- Low friction install with only two runtime dependencies (graphviz and networkx).
- Active maintenance with a recent commit on 2026-04-15 and no known vulnerabilities.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2026-04-15 (121 days) · last repo commit 2026-04-15 · 11 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 149,880 downloads/mo, #10,980 on PyPI
Alternatives
Verify before relying
pip install py-import-cycles
python3 -m py_import_cycles --packages /path/to/project/package- Whether graphviz system library (not just the Python package) is required as a separate install.
- Whether the tool produces actionable output formats (e.g., JSON, graph visualization) beyond console output.
What it is and what it does
py-import-cycles is a command-line tool that scans Python packages to find circular import dependencies. It uses Python's ast module to parse import statements and networkx to compute cycles, helping developers identify architectural problems where modules depend on each other in a loop. The tool walks the file tree of a given package, collects all Python modules, and reports any cycles it finds—useful for spotting structural weak points before they cause runtime issues or maintenance headaches.
The package is lightweight and straightforward: it doesn't integrate with Python's module finder or loader, so it analyzes only what's on disk. It's designed as a static analysis tool you run from the command line against your own codebase, making it a simple addition to code review or CI workflows when you want to check for import cycles without running the code.
Use it for
- Check a new or refactored codebase for circular imports before merging to catch structural problems early.
- Audit legacy packages to identify and prioritize which import cycles to break during a refactoring effort.
- Integrate into CI/CD to fail builds when new circular imports are introduced.
- Analyze third-party packages you're considering adopting to assess their internal architecture quality.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to detect import cycles in Python projects.
The tool is actively maintained, has no known vulnerabilities, and imposes minimal install friction. It's most useful for developers doing code reviews, refactoring, or enforcing architectural standards. Not necessary if your project already uses a linter or type checker that catches circular imports, or if import cycles aren't a concern in your workflow.
Install
py-import-cycles on PyPI
Before you install
Low friction install with only two runtime dependencies (graphviz and networkx). Active maintenance with a recent commit on 2026-04-15 and no known vulnerabilities.
Requires Python 3.12 or later; graphviz and networkx must be available at runtime.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install py-import-cycles
python3 -m py_import_cycles --packages /path/to/project/package
Verify before relying
- Whether graphviz system library (not just the Python package) is required as a separate install.
- Whether the tool produces actionable output formats (e.g., JSON, graph visualization) beyond console output.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.12 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesgraphviznetworkx |
| Maintenance | Actively maintained 121 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 149,880 / month, #10,980 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.12 |
Evidence: py_import_cycles-0.6.2-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 › “detect import cycles python”
- py-import-cyclesDetects import cycles in Python projects by walking packages,…
- mo-importsProvides patterns to resolve circular module dependencies in Python…
- cyclicDetects and reports cyclic relationships in a directed graph by…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also cyclic · import-deps · importlab · mo-imports · pydeps · rainflow · pipdeptree · update · cycler · uncalled