mirror of
https://github.com/vinta/awesome-python.git
synced 2026-03-23 13:56:43 +08:00
refactor: rename fetch_stats target and remove cache age gating
Rename the Makefile target from fetch_stats to fetch_github_stars to match the script name. Remove CACHE_MAX_AGE_DAYS and the staleness check so every run fetches all repos unconditionally. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2
Makefile
2
Makefile
@@ -4,7 +4,7 @@ export
|
||||
install:
|
||||
uv sync
|
||||
|
||||
fetch_stats:
|
||||
fetch_github_stars:
|
||||
uv run python website/fetch_github_stars.py
|
||||
|
||||
test:
|
||||
|
||||
@@ -12,7 +12,6 @@ import httpx
|
||||
|
||||
from build import extract_github_repo, load_stars
|
||||
|
||||
CACHE_MAX_AGE_DAYS = 7
|
||||
DATA_DIR = Path(__file__).parent / "data"
|
||||
CACHE_FILE = DATA_DIR / "github_stars.json"
|
||||
README_PATH = Path(__file__).parent.parent / "README.md"
|
||||
@@ -114,18 +113,8 @@ def main() -> None:
|
||||
print(f"Pruned {len(cache) - len(pruned)} stale cache entries")
|
||||
cache = pruned
|
||||
|
||||
# Determine which repos need fetching (missing or stale)
|
||||
to_fetch = []
|
||||
for repo in sorted(current_repos):
|
||||
entry = cache.get(repo)
|
||||
if entry and "fetched_at" in entry:
|
||||
fetched = datetime.fromisoformat(entry["fetched_at"])
|
||||
age_days = (now - fetched).days
|
||||
if age_days < CACHE_MAX_AGE_DAYS:
|
||||
continue
|
||||
to_fetch.append(repo)
|
||||
|
||||
print(f"{len(to_fetch)} repos to fetch ({len(current_repos) - len(to_fetch)} cached)")
|
||||
to_fetch = sorted(current_repos)
|
||||
print(f"{len(to_fetch)} repos to fetch")
|
||||
|
||||
if not to_fetch:
|
||||
save_cache(cache)
|
||||
|
||||
Reference in New Issue
Block a user