Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Downloads page: sculptforge.app/stats/ (unlisted, noindex) shows GitHub release downloads today / yesterday / 7 days / all time, per day and by platform, version and file; the hourly job keeps a per-day history on the download-stats branch instead of sending events to GoatCounter (which counted each file once)

islandmedcdc79cfd02a4
diff --git a/.github/workflows/download-stats.yml b/.github/workflows/download-stats.yml
index fdccf7d8..3ef72073 100644
--- a/.github/workflows/download-stats.yml
+++ b/.github/workflows/download-stats.yml
@@ -1,16 +1,11 @@
-# Every hour: new GitHub release downloads -> GoatCounter events "github download: <file> (<version>)"
-# (tools/download-stats.py). The last totals are kept in counts.json on the download-stats branch.
+# Every hour: GitHub release download totals -> a per-day history for the stats page (sculptforge.app/stats/),
+# by tools/download-stats.py. counts.json (last totals) and history.json live on the download-stats branch.
name: Download stats
on:
schedule:
- cron: "17 * * * *"
workflow_dispatch:
- inputs:
- backfill:
- description: "Date new downloads at their release's publish time (on a first run: send every download so far)"
- type: boolean
- default: false
permissions:
contents: write
@@ -27,22 +22,23 @@ jobs:
with:
sparse-checkout: tools/download-stats.py
sparse-checkout-cone-mode: false
- - name: Saved totals
+ - name: Saved totals and history
run: |
+ mkdir -p "$RUNNER_TEMP/state"
if git fetch --depth=1 origin download-stats 2>/dev/null; then
- git show FETCH_HEAD:counts.json > "$RUNNER_TEMP/counts.json"
+ for f in counts.json history.json; do
+ git show "FETCH_HEAD:$f" > "$RUNNER_TEMP/state/$f" 2>/dev/null || rm -f "$RUNNER_TEMP/state/$f"
+ done
fi
- - name: Send new downloads to GoatCounter
+ - name: Count new downloads
env:
GITHUB_TOKEN: ${{ github.token }}
- GOATCOUNTER_KEY: ${{ secrets.GOATCOUNTER_KEY }}
- run: python3 tools/download-stats.py --state "$RUNNER_TEMP/counts.json" ${{ inputs.backfill && '--backfill' || '' }}
- - name: Save totals
+ run: python3 tools/download-stats.py --dir "$RUNNER_TEMP/state"
+ - name: Save
run: |
- cd "$RUNNER_TEMP" && rm -rf state && mkdir state && cd state
+ cd "$RUNNER_TEMP/state"
git init -q -b download-stats
- cp ../counts.json .
- git add counts.json
+ git add counts.json history.json
git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit -qm "Download totals $(date -u +%FT%RZ)"
git push -qf "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}" download-stats
diff --git a/tools/download-stats.py b/tools/download-stats.py
index 2886b468..f479e95c 100755
--- a/tools/download-stats.py
+++ b/tools/download-stats.py
@@ -1,108 +1,106 @@
#!/usr/bin/env python3
-"""Copy GitHub release downloads into GoatCounter, so the dashboard shows every download, not only clicks on the
-website's buttons (most people download straight from GitHub, Reddit links or package managers).
+"""Keep a per-day history of GitHub release downloads for the stats page (website/stats/).
-GitHub keeps only an all-time total per release file. This compares the totals with the ones saved last run and
-sends each new download to GoatCounter as an event "github download: <file> (<version>)", next to the website's
-"download: <file>" click events. Run hourly by .github/workflows/download-stats.yml; the totals live in a JSON file
-on the download-stats branch.
+GitHub keeps only an all-time total per release file. Run hourly by .github/workflows/download-stats.yml, this
+compares the totals with the ones saved last run and adds the difference to today's entry (Pacific time) in
+history.json, which lives on the download-stats branch next to counts.json (the last totals).
- GOATCOUNTER_KEY=... python3 tools/download-stats.py --state counts.json [--dry-run] [--backfill]
+ python3 tools/download-stats.py --dir <folder with counts.json / history.json> [--dry-run]
---backfill: dates the new downloads at their release's publish time instead of now. On a first run (no saved
-totals) it sends every download so far; without it the first run only saves the totals.
+history.json:
+ {"updated": "<UTC time>", "tracking_since": "<UTC time>",
+ "before": {"<tag>/<file>": n}, downloads before tracking began, by file (dates unknown)
+ "days": {"YYYY-MM-DD": {"<tag>/<file>": n}}}
+When history.json is first created, downloads of releases published today are counted as today's (they can only
+have happened today); everything older goes to "before".
"""
import argparse
import json
import os
-import secrets
-import sys
import urllib.error
import urllib.request
from datetime import datetime, timezone
+from zoneinfo import ZoneInfo
REPO = "islandmed/SculptForge"
-GOATCOUNTER = "https://sculptforge.goatcounter.com/api/v0/count"
+ZONE = ZoneInfo("America/Vancouver")
SKIP = {"SHA256SUMS.txt"} # checksums are not a download of the app
-def api(url, token=None, data=None):
- headers = {"Accept": "application/json", "User-Agent": "sculptforge-download-stats"}
+def get(url, token=None):
+ headers = {"Accept": "application/vnd.github+json", "User-Agent": "sculptforge-download-stats"}
if token:
headers["Authorization"] = f"Bearer {token}"
- if data is not None:
- headers["Content-Type"] = "application/json"
- data = json.dumps(data).encode()
try:
- with urllib.request.urlopen(urllib.request.Request(url, data=data, headers=headers), timeout=60) as r:
- return json.load(r) if r.status != 202 else None
+ with urllib.request.urlopen(urllib.request.Request(url, headers=headers), timeout=60) as r:
+ return json.load(r)
except urllib.error.HTTPError as e:
- sys.exit(f"{url}: HTTP {e.code}: {e.read().decode(errors='replace')[:500]}")
+ raise SystemExit(f"{url}: HTTP {e.code}: {e.read().decode(errors='replace')[:500]}")
-def release_totals(github_token):
- """{"<tag>/<file>": {"count", "version", "file", "published"}} for every release file."""
- totals, page = {}, 1
- while True:
- releases = api(f"https://api.github.com/repos/{REPO}/releases?per_page=100&page={page}", github_token)
- if not releases:
- return totals
+def release_files(token):
+ """{"<tag>/<file>": (count, published_at)} for every published release file."""
+ files, page = {}, 1
+ while releases := get(f"https://api.github.com/repos/{REPO}/releases?per_page=100&page={page}", token):
for rel in releases:
if rel["draft"]:
continue
for asset in rel["assets"]:
- if asset["name"] in SKIP:
- continue
- totals[f"{rel['tag_name']}/{asset['name']}"] = {
- "count": asset["download_count"],
- "version": rel["tag_name"].lstrip("v"),
- "file": asset["name"],
- "published": rel["published_at"],
- }
+ if asset["name"] not in SKIP:
+ files[f"{rel['tag_name']}/{asset['name']}"] = (asset["download_count"], rel["published_at"])
page += 1
+ return files
+
+
+def load(path, default):
+ return json.load(open(path)) if os.path.exists(path) else default
+
+
+def save(path, value):
+ with open(path, "w") as f:
+ json.dump(value, f, indent=1, sort_keys=True)
+ f.write("\n")
def main():
ap = argparse.ArgumentParser()
- ap.add_argument("--state", required=True)
+ ap.add_argument("--dir", required=True)
ap.add_argument("--dry-run", action="store_true")
- ap.add_argument("--backfill", action="store_true")
args = ap.parse_args()
+ counts_path, history_path = (os.path.join(args.dir, n) for n in ("counts.json", "history.json"))
- totals = release_totals(os.environ.get("GITHUB_TOKEN"))
- first_run = not os.path.exists(args.state)
- saved = {} if first_run else json.load(open(args.state))
-
- now = datetime.now(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z")
- hits = []
- for key, t in sorted(totals.items()):
- new = t["count"] - saved.get(key, 0)
- if first_run and not args.backfill:
- new = 0
- when = t["published"] if args.backfill else now
- # Each download its own session: GoatCounter counts one visit per session and path, so repeats of one
- # file in a shared session would show as a single download.
- hits += [{
- "path": f"github download: {t['file']} ({t['version']})",
- "title": f"Downloaded from GitHub, SculptForge {t['version']}",
- "event": True,
- "created_at": when,
- "session": secrets.token_hex(16),
- } for _ in range(max(new, 0))]
+ files = release_files(os.environ.get("GITHUB_TOKEN"))
+ now = datetime.now(timezone.utc)
+ stamp = now.replace(microsecond=0).isoformat().replace("+00:00", "Z")
+ today = now.astimezone(ZONE).date().isoformat()
+ saved = load(counts_path, {})
+ history = load(history_path, None)
+
+ if history is None: # first run: split what's there into "before" and today
+ history = {"tracking_since": stamp, "before": {}, "days": {}}
+ for key, (count, published) in files.items():
+ day = datetime.fromisoformat(published.replace("Z", "+00:00")).astimezone(ZONE).date().isoformat()
+ bucket = history["days"].setdefault(today, {}) if day == today else history["before"]
+ if count:
+ bucket[key] = count
+ saved = {key: count for key, (count, _) in files.items()}
+ print(f"history started: {sum(history['days'].get(today, {}).values())} today, "
+ f"{sum(history['before'].values())} before")
+
+ added = 0
+ for key, (count, _) in sorted(files.items()):
+ new = count - saved.get(key, 0)
if new > 0:
+ day = history["days"].setdefault(today, {})
+ day[key] = day.get(key, 0) + new
+ added += new
print(f"{new:4d} {key}")
- print(f"{len(hits)} new downloads" + (" (first run)" if first_run else ""))
-
- if args.dry_run:
- return
- key = os.environ.get("GOATCOUNTER_KEY")
- if hits and not key:
- sys.exit("GOATCOUNTER_KEY is not set")
- for i in range(0, len(hits), 100): # the count API takes at most 100 hits per call
- api(GOATCOUNTER, key, {"hits": hits[i:i + 100]})
- with open(args.state, "w") as f: # saved only after GoatCounter took every hit
- json.dump({k: t["count"] for k, t in totals.items()}, f, indent=1, sort_keys=True)
- f.write("\n")
+ history["updated"] = stamp
+ print(f"{added} new downloads; today {sum(history['days'].get(today, {}).values())}")
+
+ if not args.dry_run:
+ save(history_path, history)
+ save(counts_path, {key: count for key, (count, _) in files.items()})
if __name__ == "__main__":
diff --git a/website/stats/index.html b/website/stats/index.html
new file mode 100644
index 00000000..3df44bac
--- /dev/null
+++ b/website/stats/index.html
@@ -0,0 +1,221 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="robots" content="noindex, nofollow">
+ <title>SculptForge Downloads</title>
+ <!-- Unlisted maintainer page: GitHub release downloads by day. Data: history.json on the download-stats
+ branch, kept hourly by tools/download-stats.py (.github/workflows/download-stats.yml). -->
+ <style>
+ @font-face { font-family: "Inter"; src: url("../fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
+ @font-face { font-family: "Inter"; src: url("../fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }
+ :root {
+ color-scheme: dark;
+ --bg: #0f0f12; --panel: #1b1b21; --border: #2a2a31; --grid: #24242b;
+ --text: #ececf1; --muted: #a3a3ad; --accent: #f28c3c; --accent-2: #ffb06a;
+ }
+ * { box-sizing: border-box; }
+ body { margin: 0; background: var(--bg); color: var(--text);
+ font: 400 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
+ main { max-width: 960px; margin: 0 auto; padding: 32px 16px 64px; }
+ h1 { font-size: 1.9rem; margin: 0 0 4px; letter-spacing: -0.01em; }
+ h2 { font-size: 1.1rem; margin: 0 0 12px; }
+ a { color: var(--accent-2); }
+ .muted { color: var(--muted); }
+ .small { font-size: 0.85rem; }
+ .tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0; }
+ .tile { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
+ .tile .label { color: var(--muted); font-size: 0.9rem; }
+ .tile .value { font-size: 2.4rem; font-weight: 700; line-height: 1.1; margin: 4px 0; font-variant-numeric: tabular-nums; }
+ .tile .sub { color: var(--muted); font-size: 0.8rem; }
+ .card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
+ .chart { position: relative; height: 200px; display: flex; align-items: flex-end; gap: 2px;
+ border-bottom: 1px solid var(--border); padding-top: 20px; }
+ .bar { flex: 1 1 0; max-width: 48px; display: flex; align-items: flex-end; height: 100%; cursor: default; }
+ .bar i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
+ .bar:hover i, .bar:focus i { background: var(--accent-2); }
+ .axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.75rem; margin-top: 6px; }
+ .tip { position: absolute; pointer-events: none; background: #000; border: 1px solid var(--border); border-radius: 8px;
+ padding: 6px 10px; font-size: 0.85rem; white-space: nowrap; transform: translate(-50%, -100%); display: none; }
+ .seg { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
+ .seg button { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 999px;
+ padding: 6px 14px; font: inherit; font-size: 0.9rem; cursor: pointer; }
+ .seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 600; }
+ .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
+ table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
+ th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--grid); font-size: 0.92rem; }
+ th { color: var(--muted); font-weight: 400; }
+ td.n, th.n { text-align: right; }
+ td.file { word-break: break-all; }
+ .err { color: #ff8a80; }
+ @media (max-width: 720px) {
+ .tiles { grid-template-columns: repeat(2, 1fr); }
+ .cols { grid-template-columns: 1fr; }
+ .tile .value { font-size: 2rem; }
+ }
+ </style>
+</head>
+<body>
+<main>
+ <h1>Downloads</h1>
+ <p class="muted small" id="status">Loading…</p>
+
+ <div class="tiles" id="tiles"></div>
+
+ <section class="card">
+ <h2>App downloads per day</h2>
+ <div class="chart" id="chart" role="img" aria-label="App downloads per day"><div class="tip" id="tip"></div></div>
+ <div class="axis" id="axis"></div>
+ </section>
+
+ <section class="card">
+ <div class="seg" id="seg" role="group" aria-label="Period">
+ <button data-p="today" aria-pressed="true">Today</button>
+ <button data-p="yesterday" aria-pressed="false">Yesterday</button>
+ <button data-p="week" aria-pressed="false">Last 7 days</button>
+ <button data-p="all" aria-pressed="false">All time</button>
+ </div>
+ <div class="cols">
+ <div><h2>By platform</h2><table id="by-platform"></table></div>
+ <div><h2>By version</h2><table id="by-version"></table></div>
+ </div>
+ <h2 style="margin-top:20px">By file</h2>
+ <table id="by-file"></table>
+ </section>
+
+ <p class="muted small">Counts are GitHub release downloads (checksum files left out), refreshed every hour; "today"
+ is Pacific time. A download is not an install: someone who grabs two formats counts twice. Days are known from
+ <span id="since"></span>; earlier downloads are in "All time" only.</p>
+</main>
+<script>
+const DATA = "https://raw.githubusercontent.com/islandmed/SculptForge/download-stats/history.json";
+const ZONE = "America/Vancouver";
+const $ = (id) => document.getElementById(id);
+const fmt = (n) => n.toLocaleString("en-US");
+
+function platform(file) {
+ if (/bridge/i.test(file)) return "Blender add-on";
+ if (/ZToolExport/i.test(file)) return "ZBrush plug-in";
+ if (/windows|\.exe$/i.test(file)) return "Windows";
+ if (/darwin|macos|\.dmg$/i.test(file)) return "macOS";
+ return "Linux";
+}
+const isApp = (file) => ["Windows", "macOS", "Linux"].includes(platform(file));
+
+function dayString(d) { return new Intl.DateTimeFormat("en-CA", { timeZone: ZONE }).format(d); } // YYYY-MM-DD
+function addDays(day, n) { const d = new Date(day + "T12:00:00Z"); d.setUTCDate(d.getUTCDate() + n); return d.toISOString().slice(0, 10); }
+function label(day, opts = { month: "short", day: "numeric" }) {
+ return new Date(day + "T12:00:00Z").toLocaleDateString("en-US", { ...opts, timeZone: "UTC" });
+}
+
+// Rows of [key, count] for a period: key is "<tag>/<file>".
+function rows(h, period) {
+ const today = dayString(new Date());
+ const days = { today: [today], yesterday: [addDays(today, -1)],
+ week: [...Array(7)].map((_, i) => addDays(today, -i)), all: Object.keys(h.days) }[period];
+ const sum = new Map();
+ const add = (obj) => { for (const [k, n] of Object.entries(obj || {})) sum.set(k, (sum.get(k) || 0) + n); };
+ days.forEach((d) => add(h.days[d]));
+ if (period === "all") add(h.before);
+ return [...sum];
+}
+const appTotal = (rs) => rs.filter(([k]) => isApp(k)).reduce((s, [, n]) => s + n, 0);
+const otherTotal = (rs) => rs.filter(([k]) => !isApp(k)).reduce((s, [, n]) => s + n, 0);
+
+function table(el, head, list) {
+ el.replaceChildren();
+ const tr = (cells, tag) => { const r = document.createElement("tr");
+ cells.forEach((c, i) => { const td = document.createElement(tag); td.textContent = c;
+ if (i === cells.length - 1) td.className = "n"; else if (head[0] === "File") td.className = "file"; r.append(td); });
+ return r; };
+ el.append(tr(head, "th"));
+ if (!list.length) { el.append(tr(["Nothing yet", ""], "td")); return; }
+ list.forEach((cells) => el.append(tr(cells, "td")));
+}
+
+function group(rs, keyOf) {
+ const m = new Map();
+ for (const [k, n] of rs) { const g = keyOf(k); m.set(g, (m.get(g) || 0) + n); }
+ return [...m].sort((a, b) => b[1] - a[1]).map(([g, n]) => [g, fmt(n)]);
+}
+
+function render(h) {
+ // A period that starts before tracking began is partly unknown: say so rather than show a 0.
+ const tracked = dayString(new Date(h.tracking_since)), today0 = dayString(new Date());
+ const starts = { today: today0, yesterday: addDays(today0, -1), week: addDays(today0, -6), all: null };
+ const tiles = [["Today", "today"], ["Yesterday", "yesterday"], ["Last 7 days", "week"], ["All time", "all"]];
+ $("tiles").replaceChildren(...tiles.map(([name, p]) => {
+ const rs = rows(h, p), t = document.createElement("div");
+ t.className = "tile";
+ t.innerHTML = `<div class="label"></div><div class="value"></div><div class="sub"></div>`;
+ t.children[0].textContent = name;
+ const o = otherTotal(rs), early = starts[p] && starts[p] < tracked;
+ if (p === "yesterday" && early) {
+ t.children[1].textContent = "—";
+ t.children[2].textContent = `not tracked yet (began ${label(tracked)})`;
+ } else {
+ t.children[1].textContent = fmt(appTotal(rs));
+ t.children[2].textContent = (early ? `since ${label(tracked)} · ` : "") + "app downloads" + (o ? ` · +${fmt(o)} add-ons` : "");
+ }
+ return t;
+ }));
+
+ // Chart: every day since tracking began (at most the last 60), app downloads.
+ const today = dayString(new Date());
+ let first = Object.keys(h.days).sort()[0] || today;
+ if (first < addDays(today, -59)) first = addDays(today, -59);
+ const days = []; for (let d = first; d <= today; d = addDays(d, 1)) days.push(d);
+ const values = days.map((d) => appTotal(Object.entries(h.days[d] || {})));
+ const max = Math.max(1, ...values);
+ const chart = $("chart"), tip = $("tip");
+ chart.querySelectorAll(".bar").forEach((b) => b.remove());
+ days.forEach((d, i) => {
+ const b = document.createElement("div"), fill = document.createElement("i");
+ b.className = "bar"; b.tabIndex = 0;
+ b.setAttribute("aria-label", `${label(d)}: ${values[i]} app downloads`);
+ fill.style.height = (values[i] / max * 100) + "%";
+ b.append(fill);
+ const show = () => { tip.textContent = `${label(d, { weekday: "short", month: "short", day: "numeric" })}: ${fmt(values[i])}`;
+ tip.style.display = "block"; tip.style.left = (b.offsetLeft + b.offsetWidth / 2) + "px";
+ tip.style.top = (b.offsetTop + b.offsetHeight - fill.offsetHeight - 6) + "px"; };
+ b.addEventListener("mouseenter", show); b.addEventListener("focus", show);
+ b.addEventListener("mouseleave", () => tip.style.display = "none"); b.addEventListener("blur", () => tip.style.display = "none");
+ chart.append(b);
+ });
+ $("axis").replaceChildren(...[days[0], days.length > 1 ? days[days.length - 1] : null].filter(Boolean)
+ .map((d) => Object.assign(document.createElement("span"), { textContent: label(d) })));
+
+ const period = document.querySelector('#seg [aria-pressed="true"]').dataset.p;
+ const rs = rows(h, period);
+ table($("by-platform"), ["Platform", "Downloads"], group(rs, (k) => platform(k)));
+ table($("by-version"), ["Version", "Downloads"], group(rs, (k) => k.split("/")[0].replace(/^v/, "")));
+ table($("by-file"), ["File", "Downloads"],
+ rs.sort((a, b) => b[1] - a[1]).slice(0, 25).map(([k, n]) => [k.replace("/", " "), fmt(n)]));
+
+ const ago = Math.round((Date.now() - Date.parse(h.updated)) / 60000);
+ $("status").textContent = `GitHub release downloads · updated ${ago < 1 ? "just now" : ago + " min ago"}`;
+ $("since").textContent = label(dayString(new Date(h.tracking_since)), { month: "long", day: "numeric", year: "numeric" });
+}
+
+let history = null;
+$("seg").addEventListener("click", (e) => {
+ const b = e.target.closest("button"); if (!b || !history) return;
+ document.querySelectorAll("#seg button").forEach((x) => x.setAttribute("aria-pressed", x === b));
+ render(history);
+});
+async function load() {
+ try {
+ const r = await fetch(DATA + "?t=" + Math.floor(Date.now() / 300000), { cache: "no-store" });
+ if (!r.ok) throw new Error("HTTP " + r.status);
+ history = await r.json();
+ render(history);
+ } catch (e) {
+ $("status").innerHTML = `<span class="err">Couldn't load the numbers (${e.message}).</span> Try again in a minute.`;
+ }
+}
+load();
+setInterval(load, 10 * 60 * 1000);
+</script>
+</body>
+</html>