Registry / testing / py-import-cycles

py-import-cycles

JSON →
library0.6.2pypypiunverified

Detect import cycles in Python projects. Version 0.6.2 supports Python >=3.12, uses AST parsing (no runtime import). Available on PyPI.

pip install py-import-cycles
INSTALL
IMPORT
SIG · PY-IMPORT-CYCLES
P
py-import-cycles
testingpythonv0.6.2
Install
3.8s avg
Import
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 32.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.8s · import 0.000s · 33MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ImportCycleFinder
from py_import_cycles import ImportCycleFinder
from py_import_cycles import ImportCycleFinder

Scan a package for import cycles. The function returns a dictionary mapping module paths to lists of cycles.

from py_import_cycles import find_cycles cycles = find_cycles('my_package', include_external=False) if cycles: print('Cycles found:', cycles) else: print('No cycles detected')
py-import-cycles --version
Debug
Known issues
breakingRequires Python >=3.12; will not install or run on older versions.
fix
Use Python 3.12 or later.
affects: 0.6.2
gotchaImport path must be resolvable on sys.path; local modules need correct package structure or working directory.
fix
Run from project root or adjust Python path.
affects: all
gotchafind_cycles uses AST parsing, so conditional imports or dynamic imports may not be detected.
fix
Static analysis only; consider runtime checks for dynamic imports.
affects: all
Upgrade
Version history
0.6.2latest on PyPI · released Apr 15, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
py-import-cycles — pip install py-import-cycles · libregistry