Skip to content

Instantly share code, notes, and snippets.

@obfusk
Last active February 17, 2023 19:36
Show Gist options
  • Save obfusk/fca414a6d0a0d6b919c137aa3a01f370 to your computer and use it in GitHub Desktop.
Save obfusk/fca414a6d0a0d6b919c137aa3a01f370 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# SPDX-FileCopyrightText: 2023 FC Stegerman <flx@obfusk.net>
# SPDX-License-Identifier: AGPL-3.0-or-later
import yaml
from typing import Iterator, Tuple
import matplotlib.pyplot as plt # type: ignore[import]
import numpy as np
def month_range(start: Tuple[int, int], end: Tuple[int, int]) -> Iterator[Tuple[int, int]]:
while start <= end:
yield start
y, m = start
start = (y + 1, 1) if m == 12 else (y, m + 1)
with open("publish-dates.yaml") as fh:
dates = set(map(str, yaml.safe_load(fh)["publish"]))
y1, m1 = map(int, min(dates).split("-")[:2])
y2, m2 = map(int, max(dates).split("-")[:2])
months = tuple(f"{y:04d}-{m:02d}" for y, m in month_range((y1, m1), (y2, m2)))
_, ax = plt.subplots()
bottom = np.zeros(len(months))
for w in range(5):
releases = [len([d for d in dates
if d.startswith(m) and 7 * w < int(d[-2:]) <= 7 * (w + 1)])
for m in months]
ax.bar(months, releases, label=f"week {w+1}", bottom=bottom)
bottom += releases
ax.legend(loc="upper left", fontsize="x-small")
ax.set_title("F-Droid.org releases per month")
ax.set_xlabel("Month")
ax.set_ylabel("Number of releases")
plt.savefig("fdroid-website.png")
publish:
- 2022-10-09
- 2022-10-10
- 2022-10-13
- 2022-10-15
- 2022-10-17
- 2022-10-18
- 2022-10-19
- 2022-10-20
- 2022-10-22
- 2022-10-23
- 2022-10-25
- 2022-10-26
- 2022-10-27
- 2022-10-28
- 2022-10-29
- 2022-10-30
- 2022-10-31
- 2022-11-01
- 2022-11-05
- 2022-11-07
- 2022-11-09
- 2022-11-11
- 2022-11-12
- 2022-11-14
- 2022-11-15
- 2022-11-16
- 2022-11-17
- 2022-11-18
- 2022-11-19
- 2022-11-20
- 2022-11-21
- 2022-11-23
- 2022-11-24
- 2022-11-26
- 2022-11-28
- 2022-11-29
- 2022-11-30
- 2022-12-01
- 2022-12-02
- 2022-12-03
- 2022-12-04
- 2022-12-05
- 2022-12-06
- 2022-12-07
- 2022-12-08
- 2022-12-09
- 2022-12-10
- 2022-12-11
- 2022-12-13
- 2022-12-14
- 2022-12-16
- 2022-12-17
- 2022-12-18
- 2022-12-19
- 2022-12-23
- 2022-12-25
- 2022-12-26
- 2022-12-27
- 2022-12-28
- 2022-12-29
- 2022-12-30
- 2023-01-01
- 2023-01-03
- 2023-01-04
- 2023-01-05
- 2023-01-06
- 2023-01-08
- 2023-01-09
- 2023-01-10
- 2023-01-11
- 2023-01-13
- 2023-01-14
- 2023-01-16
- 2023-01-17
- 2023-01-19
- 2023-01-21
- 2023-01-22
- 2023-01-26
- 2023-02-03
- 2023-02-06
- 2023-02-09
- 2023-02-12
- 2023-02-16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment