Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPEC 0: Soften explicit drop schedule. #273

Merged
merged 8 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 76 additions & 23 deletions spec-0000/SPEC0_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
]
plus36 = timedelta(days=int(365 * 3))
plus24 = timedelta(days=int(365 * 2))
delta6month = timedelta(days=int(365 // 2))

# Release data

now = datetime.now()
cutoff = now - delta6month


def get_release_dates(package, support_time=plus24):
Expand Down Expand Up @@ -71,7 +73,7 @@ def get_release_dates(package, support_time=plus24):

for ver, release_date in sorted(release_date.items()):
drop_date = release_date + support_time
if drop_date >= datetime.now():
if drop_date >= cutoff:
releases[ver] = {
"release_date": release_date,
"drop_date": drop_date,
Expand All @@ -97,7 +99,7 @@ def get_release_dates(package, support_time=plus24):
package: {
version: dates
for version, dates in releases.items()
if dates["drop_date"] > now
if dates["drop_date"] > cutoff
}
for package, releases in package_releases.items()
}
Expand All @@ -124,31 +126,82 @@ def get_release_dates(package, support_time=plus24):

# Print drop schedule

rel = {}
for name, releases in package_releases.items():
rel |= {
" ".join([name, str(ver)]): [dates["release_date"], dates["drop_date"]]
for ver, dates in releases.items()
}
data = []
for k, versions in package_releases.items():
for v, dates in versions.items():
data.append(
(
k,
v,
pd.to_datetime(dates["release_date"]),
pd.to_datetime(dates["drop_date"]),
)
)

df = pd.DataFrame(data, columns=["package", "version", "release", "drop"])

print("Saving drop schedule to schedule.md")
with open("schedule.md", "w") as fh:
current_quarter = None
df["quarter"] = df["drop"].dt.to_period("Q")

dq = df.set_index(["quarter", "package"]).sort_index()

# Sort by drop date
rel = dict(sorted(rel.items(), key=lambda item: item[1][1]))

for package, dates in rel.items():
qt = pd.to_datetime(dates[1]).to_period("Q")
print("Saving drop schedule to schedule.md")

# If drop date is in a new quarter, write out a heading
if qt != current_quarter:
if current_quarter != None:
fh.write("\n")
fh.write(f'{str(qt).replace("Q", " – Quarter ")}:\n\n')
current_quarter = qt

fh.write(
f"- {dates[1].strftime('%d %b %Y')}: drop {package} (initially released on {dates[0].strftime('%b %d, %Y')})\n"
def pad_table(table):
rows = [[el.strip() for el in row.split("|")] for row in table]
col_widths = [max(map(len, column)) for column in zip(*rows)]
rows[1] = [
el if el != "----" else "-" * col_widths[i] for i, el in enumerate(rows[1])
]
padded_table = []
for row in rows:
line = ""
for entry, width in zip(row, col_widths):
if not width:
continue
line += f"| {str.ljust(entry, width)} "
line += f"|"
padded_table.append(line)

return padded_table


def make_table(sub):
table = []
table.append("| | | |")
table.append("|----|----|----|")
for package in sorted(set(sub.index.get_level_values(0))):
vers = sub.loc[[package]]["version"]
minv, maxv = min(vers), max(vers)
rels = sub.loc[[package]]["release"]
rel_min, rel_max = min(rels), max(rels)
version_range = str(minv) if minv == maxv else f"{minv} to {maxv}"
rel_range = (
str(rel_min.strftime("%b %Y"))
if rel_min == rel_max
else f"{rel_min.strftime('%b %Y')} and {rel_max.strftime('%b %Y')}"
)
table.append(f"|{package:<15}|{version_range:<19}|released {rel_range}|")

return pad_table(table)


def make_quarter(quarter, dq):
table = ["#### " + str(quarter).replace("Q", " - Quarter ") + ":\n"]
table.append("###### Recommend drop support for:\n")
sub = dq.loc[quarter]
table.extend(make_table(sub))
return "\n".join(table)


with open("schedule.md", "w") as fh:
# we collect package 6 month in the past, and drop the first quarter
# as we might have filtered some of the packages out depending on
# when we ran the script.
tb = []
for quarter in list(sorted(set(dq.index.get_level_values(0))))[1:]:
tb.append(make_quarter(quarter, dq))

fh.write("\n\n".join(tb))
fh.write("\n")
16 changes: 16 additions & 0 deletions spec-0000/chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ section python
3.12 : 2023-10-02,2026-10-01

section numpy
1.21.0 : 2021-06-22,2023-06-22
1.22.0 : 2021-12-31,2023-12-31
1.23.0 : 2022-06-22,2024-06-21
1.24.0 : 2022-12-18,2024-12-17
1.25.0 : 2023-06-17,2025-06-16
1.26.0 : 2023-09-16,2025-09-15

section scipy
1.7.0 : 2021-06-20,2023-06-20
1.8.0 : 2022-02-05,2024-02-05
1.9.0 : 2022-07-29,2024-07-28
1.10.0 : 2023-01-03,2025-01-02
Expand All @@ -25,17 +28,20 @@ section matplotlib
3.5.0 : 2021-11-16,2023-11-16
3.6.0 : 2022-09-16,2024-09-15
3.7.0 : 2023-02-13,2025-02-12
3.8.0 : 2023-09-15,2025-09-14

section pandas
1.3.0 : 2021-07-02,2023-07-02
1.4.0 : 2022-01-22,2024-01-22
1.5.0 : 2022-09-19,2024-09-18
2.0.0 : 2023-04-03,2025-04-02
2.1.0 : 2023-08-30,2025-08-29

section scikit-image
0.19.0 : 2021-12-03,2023-12-03
0.20.0 : 2023-02-28,2025-02-27
0.21.0 : 2023-06-02,2025-06-01
0.22.0 : 2023-10-03,2025-10-02

section networkx
2.6 : 2021-07-08,2023-07-08
Expand All @@ -48,8 +54,10 @@ section scikit-learn
1.0 : 2021-09-24,2023-09-24
1.1.0 : 2022-05-12,2024-05-11
1.2.0 : 2022-12-08,2024-12-07
1.3.0 : 2023-06-30,2025-06-29

section xarray
0.18.0 : 2021-05-06,2023-05-06
0.19.0 : 2021-07-23,2023-07-23
0.20.0 : 2021-11-02,2023-11-02
0.21.0 : 2022-01-28,2024-01-28
Expand All @@ -65,8 +73,14 @@ section xarray
2023.4.0 : 2023-04-14,2025-04-13
2023.5.0 : 2023-05-19,2025-05-18
2023.6.0 : 2023-06-23,2025-06-22
2023.7.0 : 2023-07-17,2025-07-16
2023.8.0 : 2023-08-20,2025-08-19
2023.9.0 : 2023-09-26,2025-09-25

section ipython
7.23.0 : 2021-04-30,2023-04-30
7.24.0 : 2021-05-28,2023-05-28
7.25.0 : 2021-06-25,2023-06-25
7.26.0 : 2021-08-01,2023-08-01
7.27.0 : 2021-08-27,2023-08-27
7.28.0 : 2021-09-25,2023-09-25
Expand All @@ -91,3 +105,5 @@ section ipython
8.12.0 : 2023-03-30,2025-03-29
8.13.0 : 2023-04-28,2025-04-27
8.14.0 : 2023-06-02,2025-06-01
8.15.0 : 2023-09-01,2025-08-31
8.16.0 : 2023-09-29,2025-09-28
Loading