Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
download_stats Namespace Reference

Functions

 format_of (name)
 
 get_json (url, token=None)
 
 github_releases (token)
 
 snapshot (token)
 
 append (series, snap)
 
 main ()
 

Variables

str REPO = "aurelienpierreeng/ansel"
 
str API = "https://api.github.com"
 
str DOCKER_IMAGE = "aurelienpierre/ansel"
 
str DOCKER_HUB = "https://hub.docker.com/v2/repositories"
 
 MONTH_TAG_RE = re.compile(r"^nightly-(\d{4}-\d{2})$")
 
list FORMATS
 

Detailed Description

Download statistics for the nightly packages, as a daily series.

    download_stats.py snapshot                > today.json
    download_stats.py append series.json today.json > series.json

GitHub keeps one lifetime `download_count` per release asset and nothing else -- delete
the asset (the monthly prune does, and so did moving August 2026 between releases) and
its count is gone. Docker Hub keeps one lifetime `pull_count` per repository. Neither is
a time series. This turns them into one: a snapshot of every counter, once a day, appended
to a list that only ever grows. Downloads *between* two dates are the difference of two
snapshots; the loss on deletion stops mattering once the day before is on record.

Every route a user takes ends up in these counters: the website's buttons, the in-app
"Update to the latest nightly build", the Homebrew cask and the Scoop manifest all
download the release asset, and AppImageUpdate fetches the .zsync and ranges of the
AppImage. Neither Homebrew nor Scoop has analytics for third-party taps; there is
nothing to add from their side.

The build month of an asset is read from its release tag (nightly-YYYY-MM) when the tag
carries one, and from the asset's creation date otherwise -- an asset moved between
releases is created anew, so its date is the day it was moved, not the night it was built.

Function Documentation

◆ append()

download_stats.append (   series,
  snap 
)
One entry per date, the newest snapshot for a date winning; sorted by date.

Clone traffic is a rolling 14-day window, so each snapshot's `traffic` is folded
into the series' own by-date map (`series[-1]["traffic_by_day"]` carries it forward):
a day seen in several snapshots keeps the last value, and days older than the
window survive because they were recorded when they were inside it.

Definition at line 145 of file download_stats.py.

Referenced by main().

◆ format_of()

download_stats.format_of (   name)

Definition at line 69 of file download_stats.py.

Referenced by snapshot().

◆ get_json()

download_stats.get_json (   url,
  token = None 
)

Definition at line 76 of file download_stats.py.

Referenced by github_releases(), and snapshot().

◆ github_releases()

download_stats.github_releases (   token)

Definition at line 85 of file download_stats.py.

References get_json().

Referenced by snapshot().

◆ main()

download_stats.main ( void  )

Definition at line 164 of file download_stats.py.

References append(), main(), and snapshot().

Referenced by main().

◆ snapshot()

download_stats.snapshot (   token)

Definition at line 95 of file download_stats.py.

References format_of(), get_json(), and github_releases().

Referenced by main().

Variable Documentation

◆ API

str download_stats.API = "https://api.github.com"

Definition at line 50 of file download_stats.py.

◆ DOCKER_HUB

str download_stats.DOCKER_HUB = "https://hub.docker.com/v2/repositories"

Definition at line 52 of file download_stats.py.

◆ DOCKER_IMAGE

str download_stats.DOCKER_IMAGE = "aurelienpierre/ansel"

Definition at line 51 of file download_stats.py.

◆ FORMATS

list download_stats.FORMATS
Initial value:
1= [
2 (".AppImage.zsync", "zsync"),
3 ("-x86_64.AppImage", "appimage"),
4 ("-x86_64.flatpak", "flatpak"),
5 ("-arm64.dmg", "dmg-arm64"),
6 ("-i386.dmg", "dmg-i386"),
7 ("-win64.exe", "exe"),
8 ("-docker.tar.zst", "docker-archive"),
9]

Definition at line 58 of file download_stats.py.

◆ MONTH_TAG_RE

download_stats.MONTH_TAG_RE = re.compile(r"^nightly-(\d{4}-\d{2})$")

Definition at line 53 of file download_stats.py.

◆ REPO

str download_stats.REPO = "aurelienpierreeng/ansel"

Definition at line 49 of file download_stats.py.