From e552fbad05b593a2a97a4d1e7e85ec866c8fec8f Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 11 Nov 2026 09:57:10 +0100 Subject: [PATCH] fix(toxgen): Preserve caches when running with --only or --skip Unused cache entries were pruned at the end of every run. Integrations skipped via --only/--skip never access their cache entries, so a partial run wiped most of releases.jsonl and package_dependencies.jsonl. Only prune on full runs. --- scripts/populate_tox/populate_tox.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/populate_tox/populate_tox.py b/scripts/populate_tox/populate_tox.py index f0b37b1c6b..d0cbb70afa 100644 --- a/scripts/populate_tox/populate_tox.py +++ b/scripts/populate_tox/populate_tox.py @@ -1330,6 +1330,11 @@ def main() -> dict[str, list]: write_tox_file(packages) + # Unused cache entries are only pruned on full runs. With --only/--skip, + # skipped integrations don't touch (most of) their cache entries, so pruning + # would wipe them. + prune_cache = not (only_update or skip_update) + # Sort the release cache file releases = [] with open(RELEASES_CACHE_FILE) as releases_cache: @@ -1338,7 +1343,8 @@ def main() -> dict[str, list]: with open(RELEASES_CACHE_FILE, "w") as releases_cache: for release in releases: if ( - CACHE[_normalize_name(release["info"]["name"])][ + not prune_cache + or CACHE[_normalize_name(release["info"]["name"])][ release["info"]["version"] ]["_accessed"] is True @@ -1353,7 +1359,8 @@ def main() -> dict[str, list]: with open(DEPENDENCIES_CACHE_FILE, "w") as releases_cache: for release in releases: if ( - DEPENDENCIES_CACHE[release["python_version"]][ + not prune_cache + or DEPENDENCIES_CACHE[release["python_version"]][ release["install_targets_hash"] ]["_accessed"] is True