Skip to content

Commit 0776758

Browse files
stonebigclaude
andcommitted
report each dependency cycle only once, without the path leading to it
One real cycle (e.g. panel -> panel-material-ui -> panel) was warned about from every root package whose tree reaches it, flooding the output of "wppm -r .[.] -l9". Normalize the cycle (rotation-invariant) and remember reported ones, so each loop is warned about exactly once, showing only the cycle members. Also bump wppm version to 17.7.20260715. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 66a6633 commit 0776758

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎wppm/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
OTHER DEALINGS IN THE SOFTWARE.
2929
"""
3030

31-
__version__ = '17.6.20260715'
31+
__version__ = '17.7.20260715'
3232
__license__ = __doc__
3333
__project_url__ = 'http://winpython.github.io/'

‎wppm/piptree.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self, target: Optional[str] = None, wheelhouse = None):
4343
self.raw: Dict[str, Dict] = {}
4444
self.environment = self._get_environment()
4545
self._marker_evals: Dict[Tuple[str, str], bool] = {}
46+
self._reported_cycles: set = set()
4647
try:
4748
packages = self._get_packages(target or sys.executable, wheelhouse)
4849
self._process_packages(packages)
@@ -180,7 +181,14 @@ def _get_dependency_tree(self, package_name: str, extra: str = "", version_req:
180181

181182
full_name = f"{package_name}[{extra}]" if extra else package_name
182183
if full_name in path:
183-
logger.warning(f"Cycle detected: {' -> '.join(path + [full_name])}")
184+
# report only the cycle itself (not the path leading to it), and only once:
185+
# the same loop reached from other roots or entered at another point is not news
186+
cycle = path[path.index(full_name):]
187+
rotation = cycle.index(min(cycle))
188+
canonical = tuple(cycle[rotation:] + cycle[:rotation])
189+
if canonical not in self._reported_cycles:
190+
self._reported_cycles.add(canonical)
191+
logger.warning(f"Cycle detected: {' -> '.join(cycle + [full_name])}")
184192
return []
185193

186194
pkg_data = self.distro[pkg_key]

0 commit comments

Comments
 (0)