I planned to validate if my Python 3.6 code has any cyclic reference.
Given an object, get_referrers https://docs.python.org/3/library/gc.html#gc.get_referrers returns all objects that refer to the object. However, the following returns []
[o for o in gc.get_objects() if not bool(gc.get_referrers(o))]
which means all objects have at least one referrer.
I also found https://mg.pov.lt/objgraph/objgraph.html#objgraph.is_proper_module that uses modules as roots.
[o for o in gc.get_objects() if objgraph.is_proper_module(o)]
although the modules can still refer to each other... Is this the correct way to find roots?