diff --git a/.github/scripts/update_metrics.py b/.github/scripts/update_metrics.py index bc5ea90..87d712c 100644 --- a/.github/scripts/update_metrics.py +++ b/.github/scripts/update_metrics.py @@ -139,8 +139,22 @@ def download_series(pepy: dict, *, days: int = 90) -> list[tuple[date, int]]: return [(start + timedelta(days=i), totals.get(start + timedelta(days=i), 0)) for i in range(days)] -def render_download_chart(series: list[tuple[date, int]], *, total_downloads: int) -> str: +def cumulative_download_series( + daily: list[tuple[date, int]], *, total_downloads: int +) -> list[tuple[date, int]]: + """Convert a daily window into an estimated cumulative all-time series.""" + window_total = sum(value for _, value in daily) + running = max(0, total_downloads - window_total) + cumulative: list[tuple[date, int]] = [] + for day, value in daily: + running += value + cumulative.append((day, running)) + return cumulative + + +def render_download_chart(daily_series: list[tuple[date, int]], *, total_downloads: int) -> str: """Render a dependency-free SVG chart for README embedding.""" + series = cumulative_download_series(daily_series, total_downloads=total_downloads) width = 920 height = 360 left = 70 @@ -149,7 +163,7 @@ def render_download_chart(series: list[tuple[date, int]], *, total_downloads: in bottom = 64 chart_w = width - left - right chart_h = height - top - bottom - max_y = max([value for _, value in series] + [1]) + max_y = max([value for _, value in series] + [total_downloads, 1]) # Give the line a little headroom and round the top tick to a clean value. top_tick = max(10, int(((max_y * 1.18) + 9) // 10 * 10)) @@ -196,10 +210,10 @@ def y_for(value: int | float) -> float: start_label = series[0][0].strftime("%b %-d, %Y") if series else "" end_label = series[-1][0].strftime("%b %-d, %Y") if series else "" - latest_value = series[-1][1] if series else 0 - total_window = sum(value for _, value in series) + latest_value = series[-1][1] if series else total_downloads + total_window = sum(value for _, value in daily_series) subtitle = ( - f"Daily downloads, last {len(series)} days · {fmt(total_window)} in window · " + f"Cumulative downloads, last {len(series)} days · +{fmt(total_window)} in window · " f"{fmt(total_downloads)} all time" ) generated_at = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M UTC") @@ -208,23 +222,22 @@ def y_for(value: int | float) -> float: f'' ), - f' {escape(PKG)} PyPI download history', + f' {escape(PKG)} cumulative PyPI download history', ( - f' Daily PyPI downloads from Pepy for {escape(PKG)} ' + f' Cumulative PyPI downloads from Pepy for {escape(PKG)} ' f"between {escape(start_label)} and {escape(end_label)}." ), f' ', ( f' {escape(PKG)} PyPI downloads' + f'fill="#111827">{escape(PKG)} cumulative PyPI downloads' ), f' {escape(subtitle)}', ( f' {escape(short_fmt(latest_value))}' ), - f' latest day', + f' all time', *grid_lines, *axis_labels, ( diff --git a/METRICS.md b/METRICS.md index edb3889..ea91aef 100644 --- a/METRICS.md +++ b/METRICS.md @@ -1,6 +1,6 @@ # docpull metrics -_Last updated: 2026-06-12 18:16 UTC. Auto-generated by `.github/workflows/metrics.yml`; do not edit by hand._ +_Last updated: 2026-06-12 18:24 UTC. Auto-generated by `.github/workflows/metrics.yml`; do not edit by hand._ ## Snapshot @@ -13,7 +13,7 @@ _Last updated: 2026-06-12 18:16 UTC. Auto-generated by `.github/workflows/metric | GitHub forks | 2 | | GitHub watchers | 1 | | Open issues | 0 | -| Open PRs | 6 | +| Open PRs | 5 | | Repo clones (last 14d) | 3,029 | | Unique cloners (last 14d) | 425 | | Repo views (last 14d) | 95 | diff --git a/docs/downloads-history.svg b/docs/downloads-history.svg index a65bffa..b2852b6 100644 --- a/docs/downloads-history.svg +++ b/docs/downloads-history.svg @@ -1,28 +1,28 @@ - docpull PyPI download history - Daily PyPI downloads from Pepy for docpull between Mar 14, 2026 and Jun 11, 2026. + docpull cumulative PyPI download history + Cumulative PyPI downloads from Pepy for docpull between Mar 14, 2026 and Jun 11, 2026. - docpull PyPI downloads - Daily downloads, last 90 days · 6,275 in window · 11,351 all time - 26 - latest day + docpull cumulative PyPI downloads + Cumulative downloads, last 90 days · +6,275 in window · 11,351 all time + 11.4k + all time 0 -265 -530 -795 -1.1k +3.4k +6.7k +10.1k +13.4k - - + + Mar 14 Apr 01 May 01 Jun 01 Source: pepy.tech API - Generated 2026-06-12 18:17 UTC + Generated 2026-06-12 18:24 UTC