Skip to content

Instantly share code, notes, and snippets.

@wholmgren
Last active February 9, 2022 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wholmgren/98e93ea96f2bdf5f81d4f9d6a61db119 to your computer and use it in GitHub Desktop.
Save wholmgren/98e93ea96f2bdf5f81d4f9d6a61db119 to your computer and use it in GitHub Desktop.
Updated version of https://numpy.org/neps/nep-0029-deprecation_policy.html#references-and-footnotes - would be nice to use a tool to automatically fetch python/numpy/scipy/pandas release dates! Does it already exist?
from datetime import datetime, timedelta
# python dates from
# https://www.python.org/doc/versions/
# numpy dates from
# https://pypi.org/project/numpy/#history
data = """Jan 15, 2017: NumPy 1.12
Sep 13, 2015: Python 3.5
Dec 23, 2016: Python 3.6
Jun 27, 2018: Python 3.7
Jun 07, 2017: NumPy 1.13
Jan 06, 2018: NumPy 1.14
Jul 23, 2018: NumPy 1.15
Jan 13, 2019: NumPy 1.16
Jul 26, 2019: NumPy 1.17
Oct 14, 2019: Python 3.8
Dec 22, 2019: NumPy 1.18
Jun 20, 2020: NumPy 1.19
Oct 05, 2020: Python 3.9
Jan 30, 2021: NumPy 1.20
Jun 22, 2021: NumPy 1.21
Oct 04, 2021: Python 3.10
Dec 31, 2021: NumPy 1.22
"""
releases = []
plus42 = timedelta(days=int(365*3.5 + 1))
plus24 = timedelta(days=int(365*2 + 1))
for line in data.splitlines():
date, project_version = line.split(':')
project, version = project_version.strip().split(' ')
release = datetime.strptime(date, '%b %d, %Y')
if project.lower() == 'numpy':
drop = release + plus24
else:
drop = release + plus42
releases.append((drop, project, version, release))
releases = sorted(releases, key=lambda x: x[0])
py_major,py_minor = sorted([int(x) for x in r[2].split('.')] for r in releases if r[1] == 'Python')[-1]
minpy = f"{py_major}.{py_minor+1}+"
num_major,num_minor = sorted([int(x) for x in r[2].split('.')] for r in releases if r[1] == 'NumPy')[-1]
minnum = f"{num_major}.{num_minor+1}+"
toprint_drop_dates = ['']
toprint_support_table = []
for d, p, v, r in releases[::-1]:
df = d.strftime('%b %d, %Y')
toprint_drop_dates.append(
f'On {df} drop support for {p} {v} '
f'(initially released on {r.strftime("%b %d, %Y")})')
toprint_support_table.append(f'{df} {minpy:<6} {minnum:<5}')
if p.lower() == 'numpy':
minnum = v+'+'
else:
minpy = v+'+'
print("On next release, drop support for Python 3.5 (initially released on Sep 13, 2015)")
for e in toprint_drop_dates[-4::-1]:
print(e)
print('============ ====== =====')
print('Date Python NumPy')
print('------------ ------ -----')
for e in toprint_support_table[-4::-1]:
print(e)
print('============ ====== =====')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment