Skip to content

Commit 29a6f68

Browse files
authored
trace log both current and prior plugin hash values (#20759)
I was debugging an issue where cache entries were being invalidated due to a plugin hash not matching. It would have helped a little to have both hashes listed so I could see which plugin didn't match and have the hash to go hunt down the problem file on my workstation. In this repo, first run (no cache): ``` $ mypy --config-file mypy_self_check.ini -vv mypy 2> l Success: no issues found in 190 source files (.venv) ecsb@fw16 ~/src/o/c-mypy (cbs/hash-debug) $ grep Plugin l TRACE: Plugins snapshot (fresh) {"mypy.plugins.proper_plugin": "none:4449d775ee477b70f3e3ad7268db2128dae4324d"} ``` Second run: ``` $ mypy --config-file mypy_self_check.ini -vv mypy 2> l2 Success: no issues found in 190 source files $ grep Plugin l2 TRACE: Plugins snapshot (cached) {"mypy.plugins.proper_plugin":"none:4449d775ee477b70f3e3ad7268db2128dae4324d"} TRACE: Plugins snapshot (fresh) {"mypy.plugins.proper_plugin": "none:4449d775ee477b70f3e3ad7268db2128dae4324d"} ```
1 parent 1be60fe commit 29a6f68

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

mypy/build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,8 @@ def __init__(
848848
self.plugin = plugin
849849
self.plugins_snapshot = plugins_snapshot
850850
self.old_plugins_snapshot = read_plugins_snapshot(self)
851+
if self.verbosity() >= 2:
852+
self.trace(f"Plugins snapshot (fresh) {json.dumps(self.plugins_snapshot)}")
851853
self.quickstart_state = read_quickstart_file(options, self.stdout)
852854
# Fine grained targets (module top levels and top level functions) processed by
853855
# the semantic analyzer, used only for testing. Currently used only by the new
@@ -1355,7 +1357,7 @@ def read_plugins_snapshot(manager: BuildManager) -> dict[str, str] | None:
13551357
snapshot = _load_json_file(
13561358
PLUGIN_SNAPSHOT_FILE,
13571359
manager,
1358-
log_success="Plugins snapshot ",
1360+
log_success="Plugins snapshot (cached) ",
13591361
log_error="Could not load plugins snapshot: ",
13601362
)
13611363
if snapshot is None:

0 commit comments

Comments
 (0)