The `cyclic` Python library, currently at version 1.0.0, is designed to handle and detect cyclic relations between objects. It allows you to add parent-child relationships and then query if a specific object is part of a cyclic dependency. The library has a low release cadence, with its last update in 2018.
pip install cyclicVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `Cyclic` checker, add parent-child relationships, and then use `is_cyclic()` to determine if an object is part of a cyclic dependency. It shows a clear example of how to introduce and detect a cycle.
For Python circular import issues, refactor your module structure to break the dependency cycle (e.g., move shared code to a common module, use lazy imports, or reorganize responsibilities).
Assess the stability and compatibility in your specific Python environment. For new projects requiring robust dependency management, evaluate more actively maintained alternatives or be prepared to fork and maintain the library yourself.
Run `pip install cyclic` to install the package.
Use the correct method `cy.add(child_object, parent_object)` to establish a dependency.
Ensure that the objects you are tracking with `cyclic.Cyclic` are immutable and thus hashable (e.g., strings, numbers, tuples, or custom objects with a `__hash__` method). If you need to track mutable objects, use a unique immutable identifier for each object instead.
No dependency data recorded yet.