diff --git a/tools/hooks/sync_dependencies.py b/tools/hooks/sync_dependencies.py index 0878a5f56eb..baba1643d72 100755 --- a/tools/hooks/sync_dependencies.py +++ b/tools/hooks/sync_dependencies.py @@ -4,6 +4,7 @@ # License: BSD-3-Clause # Copyright the MNE-Python contributors. +import difflib import re from importlib.metadata import metadata from pathlib import Path @@ -92,4 +93,9 @@ def _prettify_pin(pin): skip = False if not skip: out_lines.append(line) -README_PATH.write_text("\n".join(out_lines) + "\n", encoding="utf-8") +new = "\n".join(out_lines) + "\n" +old = README_PATH.read_text("utf-8") +if new != old: + diff = "\n".join(difflib.unified_diff(old.splitlines(), new.splitlines())) + print(f"Updating {README_PATH} with diff:\n{diff}") + README_PATH.write_text(new, encoding="utf-8")