-
Notifications
You must be signed in to change notification settings - Fork 40
/
barcalendar.py
741 lines (666 loc) · 24.2 KB
/
barcalendar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
"""
Write JavaScript code to be pasted into a Google Sheet to draw a calendar.
0. Update the data. Search for "Editable content" below.
1. Run this program. It prints JavaScript code. Copy it.
2. Open a Google Sheet, either the existing Support Windows spreadsheet
(https://docs.google.com/spreadsheets/d/1wtpoypH1XOPc_G6h9AUNXJ6XiNKD6dlkMP3lubdpE9I)
or a new spreadsheet.
3. Select the "Support Windows" sheet or create a new sheet if it doesn't exist already.
4. Open the script editor (Extensions - Apps Script).
5. If there's any code there, delete it.
6. Paste the JavaScript code this program wrote.
7. Save the code. The function picker at the top should select makeBarCalendar.
8. Click the Run tool on the toolbar.
9. Your sheet should now be populated with a beautiful calendar.
"""
import atexit
import colorsys
import datetime
import itertools
import logging
import re
import time
import requests
import yaml
def setup_custom_logging():
"""
Create a custom logger to flush all Warning logs at the end of the script
to avoid breaking the console script being generated by the script
"""
class DelayedLogHandler(logging.Handler):
def __init__(self):
super().__init__()
self.log_records = []
def emit(self, record):
self.log_records.append(f"// {record}")
def _flush_log_records(handler):
for record in handler.log_records:
print(record)
# Create a custom log handler
custom_log_handler = DelayedLogHandler()
custom_log_handler.setLevel(logging.WARNING)
# Create custom logger and attach custom_handler to it
eol_logger = logging.getLogger("eol_logger")
eol_logger.addHandler(custom_log_handler)
# Register a function to flush log records at exit
atexit.register(_flush_log_records, custom_log_handler)
# Return custom logger to use in the script
return eol_logger
def validate_version_date(project, version, year, month, check_start=False):
"""
Validates the end-of-life(EOL) or release date for a project version.
Returns the correct EOL/releaseDate in case of a conflict with api value.
Parameters:
project (str): The name of the project.
version (str): The version of the project.
year (int): The year of the EOL/release date.
month (int): The month of the EOL/release date.
check_start (bool): Boolean flag to check either EOL or release date
Returns:
tuple: A tuple representing the validated EOL/release date (year, month)
"""
try:
response = requests.get(
url=f"https://endoflife.date/api/{project}/{version}.json",
headers={'Accept': 'application/json'}
)
if response.status_code != 200:
eol_logger.error(f"Project not Found: {project}/{version} not found on endoflife.date")
return (year, month)
version_info = response.json()
if check_start:
eol_year, eol_month, _ = version_info['releaseDate'].split("-")
date_type = "releaseDate"
else:
if version_info['eol'] == False:
eol_logger.warning(f"No EOL found for {project} {version}")
return (year, month)
eol_year, eol_month, _ = version_info['eol'].split("-")
date_type = "eol"
if (year, month) == (int(eol_year), int(eol_month)):
return (year, month)
else:
eol_logger.warning(f"Invalid EOL: Update {project} {version} {date_type} to {eol_month}/{eol_year} instead")
return (int(eol_year), int(eol_month))
except requests.exceptions.RequestException as e:
eol_logger.error(f"API request failed with an exception: {str(e)}")
return (year, month)
def css_to_rgb(hex):
assert hex[0] == "#"
return [int(h, 16)/255 for h in [hex[1:3], hex[3:5], hex[5:7]]]
def rgb_to_css(r, g, b):
return "#" + "".join(f"{int(v*255):02x}" for v in (r, g, b))
def lighten(css, amount=0.5):
"""Make a CSS color some amount lighter."""
h, l, s = colorsys.rgb_to_hls(*css_to_rgb(css))
lighter = colorsys.hls_to_rgb(h, l + (1 - l) * amount, s)
return rgb_to_css(*lighter)
def darken(css, amount=0.5):
"""Make a CSS color some amount darker."""
h, l, s = colorsys.rgb_to_hls(*css_to_rgb(css))
lighter = colorsys.hls_to_rgb(h, l - l * amount, s)
return rgb_to_css(*lighter)
class BaseCalendar:
def __init__(self, start, end):
self.start = start
self.end = end
self.width = 12 * (end - start + 1)
def column(self, year, month):
return (year - self.start) * 12 + month - 1
def bar(self, name, start, end=None, length=None, **kwargs):
istart = self.column(*start)
if length is None:
iend = self.column(*end)
else:
iend = istart + length - 1
if istart >= self.width:
return # bar is entirely in the future.
if iend < 0:
return # bar is entirely in the past.
istart = max(0, istart)
iend = min(self.width - 1, iend)
if end and end[0] == 3000:
kwargs.update(indefinite=True)
self.rawbar(istart, iend, name, **kwargs)
class GsheetCalendar(BaseCalendar):
def __init__(self, start, end):
super().__init__(start, end)
self.currow = 1
self.cycling = None
self.gaps = []
self.footnotes = []
self.prologue()
def prologue(self):
print(f"""\
function makeBarCalendar() {{
var sheet = SpreadsheetApp.getActiveSheet();
sheet.getDataRange().deleteCells(SpreadsheetApp.Dimension.ROWS);
sheet.insertRowsAfter(sheet.getDataRange().getLastRow(), 200);
""")
def epilog(self):
print(f"""\
range = sheet.getDataRange();
sheet.setColumnWidths(range.getColumn(), range.getWidth(), 12);
sheet.setRowHeights(range.getRow(), range.getHeight(), 18);
range.setFontSize(9);
""")
for gap_row in self.gaps:
print(f"""\
sheet.setRowHeight({gap_row}, 6);
""")
print(f"""\
var keepRows = 0; // Number of extra rows to keep at the bottom.
var tooMany = sheet.getMaxRows() - range.getLastRow() - keepRows;
if (tooMany > 0) {{
sheet.deleteRows(range.getLastRow() + keepRows + 1, tooMany);
}}
var keepCols = 0; // Number of extra columns to keep at the right.
var tooMany = sheet.getMaxColumns() - range.getLastColumn() - keepCols;
if (tooMany > 0) {{
sheet.deleteColumns(range.getLastColumn() + keepCols + 1, tooMany);
}}
for (var c = 12; c <= range.getLastColumn(); c += 12) {{
sheet.getRange(1, c, sheet.getMaxRows(), 1)
.setBorder(null, null, null, true, null, null, "black", null);
}}
}}
""")
def years_months(self):
yearrow = self.currow
monthrow = self.currow + 1
self.currow += 2
print(f"""\
sheet.insertColumns(1, {(self.end - self.start + 1) * 12});
""")
for year in range(self.start, self.end+1):
iyear = self.column(year, 1) + 1
print(f"""\
sheet.getRange({yearrow}, {iyear}, 1, 12)
.merge()
.setBorder(null, null, null, true, null, null, "black", null)
.setValue("{year}");
for (m = 0; m < 12; m++) {{
sheet.getRange({monthrow}, {iyear}+m).setValue("JFMAMJJASOND"[m]);
}}
""")
print(f"""\
sheet.getRange({yearrow}, 1, 1, {self.width})
.setFontWeight("bold")
.setHorizontalAlignment("center");
sheet.getRange({monthrow}, 1, 1, {self.width})
.setHorizontalAlignment("center");
""")
print(f"""\
var rules = sheet.getConditionalFormatRules();
rules.push(
SpreadsheetApp.newConditionalFormatRule()
.whenFormulaSatisfied("=(year(now())-$A$1)*12+1 = column()")
.setBackground("#E9CECE")
.setRanges([sheet.getRange({yearrow}, 1, 1, {self.width})])
.build()
);
rules.push(
SpreadsheetApp.newConditionalFormatRule()
.whenFormulaSatisfied("=(year(now())-$A$1)*12 + (month(now())) = column()")
.setBackground("#E9CECE")
.setRanges([sheet.getRange({monthrow}, 1, 1, {self.width})])
.build()
);
sheet.setConditionalFormatRules(rules);
""")
def rawbar(
self,
istart,
iend,
name,
color=None,
text_color=None,
current=False,
alternate=False,
indefinite=False,
note=None,
):
text = name
formatting = ""
if color:
if current:
color = darken(color, .15)
formatting += f""".setBackground({color!r})"""
if text_color:
formatting += f""".setFontColor({text_color!r})"""
if current:
formatting += """.setBorder(true, true, true, true, null, null, "black", SpreadsheetApp.BorderStyle.SOLID_MEDIUM)"""
formatting += """.setFontWeight("bold")"""
elif alternate:
formatting += """.setBorder(true, true, true, true, null, null, "black", SpreadsheetApp.BorderStyle.SOLID)"""
formatting += """.setFontWeight("bold")"""
formatting += """.setFontStyle("italic")"""
text = f"** {text} **"
if indefinite:
iend = self.width - 24
if note:
self.footnotes.append(note)
text = f"{text} (note {len(self.footnotes)})"
print(f"""\
sheet.getRange({self.currow}, {istart + 1}, 1, {iend - istart + 1})
.merge()
{formatting}
.setValue({text!r});
""")
if indefinite:
for i in range(4):
bg = lighten(color, amount=(i+1)/5)
print(f"""\
sheet.getRange({self.currow}, {self.width - 22 + i * 3}, 1, 3)
.merge()
.setBackground({bg!r});
""")
print(f"""\
sheet.getRange({self.currow}, {self.width - 10}, 1, 1)
.setValue("(indefinite end)");
""")
self.next_bar()
def set_cycling(self, cycling):
if cycling:
self.top_cycling_row = self.currow
else:
self.currow = self.top_cycling_row + self.cycling
self.cycling = cycling
def next_bar(self):
self.currow += 1
if self.cycling:
if self.currow >= self.top_cycling_row + self.cycling:
self.currow = self.top_cycling_row
def gap_line(self):
self.gaps.append(self.currow)
self.currow += 1
def text_line(self, text):
print(f"""\
sheet.getRange({self.currow}, 1).setValue({text!r})
""")
self.currow += 1
def section_note(self, text):
print(f"""\
sheet.getRange({self.currow}, {self.width - 10}).setValue({text!r});
""")
def footnote_lines(self):
for i, note in enumerate(self.footnotes, start=1):
self.text_line(f"Note {i}: {note}")
def freeze_here(self):
print(f"""\
sheet.setFrozenRows({self.currow - 1});
""")
def column_marker(self, column):
print(f"""\
sheet.getRange(1, {column}, sheet.getMaxRows(), 1)
.setBorder(false, false, false, true, false, false, "black", SpreadsheetApp.BorderStyle.DASHED);
""")
def write(self):
self.epilog()
def get_defaults_from_tutor():
"""
Fetches default configurations from tutor repository.
Returns:
object: Default configurations as Python object
"""
url = "https://raw.githubusercontent.com/overhangio/tutor/master/tutor/templates/config/defaults.yml"
while True:
try:
resp = requests.get(url, timeout=10)
except requests.RequestException as exc:
print(f"Couldn't fetch {url}: {exc}")
raise
if resp.status_code == 429:
wait = int(resp.headers.get("Retry-After", 10))
time.sleep(wait + 1)
else:
break
if resp.status_code == 200:
return yaml.safe_load(resp.text)
resp.raise_for_status()
def parse_version_number(line):
"""
Get version number in line from YAML file.
Note that this only captures major and minor version (not patch number).
e.g. "docker.io/elasticsearch:7.17.9" -> "7.17"
"""
match = re.search(r'(?P<version_number>\d+(\.\d+)?)', line)
if match is not None:
version_number = match.group("version_number")
return version_number
raise ValueError(f"Couldn't get version number from {line!r}")
def parse_version_name(line):
"""
Get openedx version name in line from YAML file.
e.g.1 "open-release/palm.1" -> "Palm"
e.g.2 "open-release/palm.master" -> "Palm"
"""
match = re.search(r'/(?P<version_name>[A-Za-z]+)\.', line)
if match is not None:
version_name = match.group("version_name")
return version_name.capitalize()
raise ValueError(f"Couldn't get version name from {line!r}")
eol_logger = setup_custom_logging()
# ==== Editable content ====
# Global Options
START_YEAR = 2020
END_YEAR = 2027
LTS_ONLY = True
versions = get_defaults_from_tutor()
# The current versions of everything. Use the same strings as the keys in the various sections below.
CURRENT = {
"Open edX": parse_version_name(versions['OPENEDX_COMMON_VERSION']),
"Python": "3.11",
"Django": "4.2",
"Ubuntu": "20.04",
"Node": "18.x",
"Mongo": parse_version_number(versions['DOCKER_IMAGE_MONGODB']),
"MySQL": parse_version_number(versions['DOCKER_IMAGE_MYSQL']),
"Elasticsearch": parse_version_number(versions['DOCKER_IMAGE_ELASTICSEARCH']),
"Redis": parse_version_number(versions['DOCKER_IMAGE_REDIS']),
"Ruby": "3.3",
}
EDX = {
"Python": "3.11",
"Django": "4.2",
"Ubuntu": "20.04",
"Node": "18.x",
"Mongo": "4.2",
"MySQL": "5.7",
"Elasticsearch": "7.10",
"Redis": "6.2",
"Ruby": "3.0",
}
cal = GsheetCalendar(START_YEAR, END_YEAR)
cal.years_months()
# Open edX releases
cal.section_note("https://edx.readthedocs.io/projects/edx-developer-docs/en/latest/named_releases.html")
cal.set_cycling(3)
names = [
# (Name, Year, Month) when the release happened.
('Aspen', 2014, 10),
('Birch', 2015, 2),
('Cypress', 2015, 8),
('Dogwood', 2016, 2),
('Eucalyptus', 2016, 8),
('Ficus', 2017, 2),
('Ginkgo', 2017, 8),
('Hawthorn', 2018, 8),
('Ironwood', 2019, 3),
('Juniper', 2020, 6),
("Koa", 2020, 12),
("Lilac", 2021, 6),
("Maple", 2021, 12),
("Nutmeg", 2022, 6),
("Olive", 2022, 12),
("Palm", 2023, 6),
("Quince", 2023, 12),
("Redwood", 2024, 6),
]
# https://www.treenames.net/common_tree_names.html
future = ["Sumac", "Teak"] + list("UVWXYZ")
target_length = 6 # months per release
releases = list(itertools.chain(names, [(name, None, None) for name in future]))
last = (None, None)
last_current = False
for (name, year, month), (_, nextyear, nextmonth) in zip(releases, releases[1:]):
if year is None:
year, month = last
month += target_length
yearplus, month = divmod(month, 12)
year += yearplus
if nextyear is None:
length = target_length
else:
length = (nextyear * 12 + nextmonth) - (year * 12 + month)
current = (name==CURRENT["Open edX"])
cal.bar(name, start=(year, month), length=length, color="#fce5cd", current=current)
if last_current:
cal.column_marker(cal.column(year, month) + length)
last = (year, month)
last_current = current
cal.set_cycling(None)
cal.freeze_here()
cal.text_line(
"This calendar is part of OEP-10, please don't change it without considering the impact there." +
f" Last updated {datetime.datetime.now():%d-%b-%Y}"
)
# Django releases
cal.section_note("https://www.djangoproject.com/download/#supported-versions")
django_releases = [
# (Version, Year, Month, Is_LTS) when the release happened.
# ('1.8', 2015, 4, True),
# ('1.9', 2016, 1, False),
# ('1.10', 2016, 8, False),
# ('1.11', 2017, 4, True),
# ('2.0', 2018, 1, False),
# ('2.1', 2018, 8, False),
# ('2.2', 2019, 4, True),
# ('3.0', 2020, 1, False),
# ('3.1', 2020, 8, False),
('3.2', 2021, 4, True),
('4.0', 2021, 12, False),
('4.1', 2022, 8, False),
('4.2', 2023, 4, True, "Django 4.2 work is being tracked in https://github.com/openedx/platform-roadmap/issues/269"),
('5.0', 2023, 12, False),
('5.1', 2024, 8, False),
('5.2', 2025, 4, True),
]
for name, year, month, lts, *more in django_releases:
year, month = validate_version_date("Django", name, year, month, check_start=True)
if LTS_ONLY and not lts:
continue
length = 3*12 if lts else 16
color = "#44b78b" if lts else "#c9f0df"
cal.bar(
f"Django {name}",
start=(year, month),
length=length,
color=color,
current=(name==CURRENT["Django"]),
alternate=(name==EDX["Django"]),
note=(more[0] if more else None),
)
cal.gap_line()
# Python releases
python_releases = [
# Version, and Year-Month for start and end of support.
#('2.7', 2010, 7, 2019, 12),
('3.5', 2015, 9, 2020, 9), # https://www.python.org/dev/peps/pep-0478/
#('3.6', 2016, 12, 2021, 12), # https://www.python.org/dev/peps/pep-0494/
#('3.7', 2018, 6, 2023, 6), # https://www.python.org/dev/peps/pep-0537/
('3.8', 2019, 10, 2024, 10), # https://www.python.org/dev/peps/pep-0569/
#('3.9', 2020, 10, 2025, 10), # https://www.python.org/dev/peps/pep-0596/
('3.10', 2021, 10, 2026, 10), # https://www.python.org/dev/peps/pep-0619/
('3.11', 2022, 10, 2027, 10), # https://peps.python.org/pep-0664/
('3.12', 2023, 10, 2028, 10), # https://peps.python.org/pep-0693/
]
for name, syear, smonth, eyear, emonth in python_releases:
eyear, emonth = validate_version_date("Python", name, eyear, emonth)
cal.bar(
f"Python {name}",
start=(syear, smonth),
end=(eyear, emonth),
color="#ffd545",
current=(name==CURRENT["Python"]),
alternate=(name==EDX["Python"]),
)
cal.gap_line()
# Ubuntu releases
ubuntu_nicks = { # https://wiki.ubuntu.com/Releases
#'16.04': 'Xenial Xerus',
'18.04': 'Bionic Beaver',
'20.04': 'Focal Fossa',
'22.04': 'Jammy Jellyfish',
'24.04': 'Noble Numbat',
}
for year, month in itertools.product(range(START_YEAR % 100, END_YEAR % 100), [4, 10]):
name = f"{year:d}.{month:02d}"
lts = (year % 2 == 0) and (month == 4)
if LTS_ONLY and not lts:
continue
length = 5*12 if lts else 9
color = "#E95420" if lts else "#F4AA90" # http://design.ubuntu.com/brand/colour-palette
nick = ubuntu_nicks.get(name, '')
if nick:
nick = f" {nick}"
year, month = validate_version_date("Ubuntu", name, 2000+year, month, check_start=True)
cal.bar(
f"Ubuntu {name}{nick}",
(year, month),
length=length,
color=color,
text_color="white",
current=(name==CURRENT["Ubuntu"]),
alternate=(name==EDX["Ubuntu"]),
)
cal.gap_line()
# Node releases
cal.section_note("https://github.com/nodejs/Release")
node_releases = [
#('6.x', 2016, 4, 2019, 4),
#('8.x', 2017, 5, 2019, 12),
# ('10.x', 2018, 4, 2021, 4),
# ('12.x', 2019, 4, 2022, 4),
('14', 2020, 4, 2023, 4),
('16', 2021, 4, 2023, 9), # https://nodejs.org/en/blog/announcements/nodejs16-eol/
('18', 2022, 4, 2025, 4),
('20', 2023, 4, 2026, 4),
('22', 2024, 4, 2027, 4),
]
for name, syear, smonth, eyear, emonth in node_releases:
eyear, emonth = validate_version_date("NodeJS", name, eyear, emonth)
cal.bar(
f"Node {name}",
start=(syear, smonth),
end=(eyear, emonth),
color="#2f6c1b",
text_color="white",
current=(name==CURRENT["Node"]),
alternate=(name==EDX["Node"]),
)
cal.gap_line()
# Mongo releases
cal.section_note("https://www.mongodb.com/support-policy/legacy") # search for MongoDB Server
mongo_releases = [
#('3.0', 2015, 3, 2018, 2),
#('3.2', 2015, 12, 2018, 9),
#('3.4', 2016, 11, 2020, 1),
#('3.6', 2017, 11, 2021, 4),
('4.0', 2018, 6, 2022, 4),
('4.2', 2019, 8, 2023, 4),
('4.4', 2020, 7, 2024, 2),
('5.0', 2021, 7, 2024, 10),
('7.0', 2023, 8, 2026, 8),
]
for name, syear, smonth, eyear, emonth in mongo_releases:
eyear, emonth = validate_version_date("mongo", name, eyear, emonth)
cal.bar(
f"Mongo {name}",
start=(syear, smonth),
end=(eyear, emonth),
color="#4da65a",
current=(name==CURRENT["Mongo"]),
alternate=(name==EDX["Mongo"]),
)
cal.gap_line()
# MySQL releases
cal.section_note("https://endoflife.date/mysql")
mysql_releases = [
('5.6', 2013, 2, 2021, 2),
('5.7', 2015, 10, 2023, 10),
('8.0', 2018, 4, 2026, 4),
('8.1', 2023, 6, 2023, 10),
('8.4', 2024, 4, 2032, 4),
('9.0', 2024, 7, 2025, 7),
]
for name, syear, smonth, eyear, emonth in mysql_releases:
eyear, emonth = validate_version_date("MySQL", name, eyear, emonth)
cal.bar(
f"MySQL {name}",
start=(syear, smonth),
end=(eyear, emonth),
color="#b9dc48",
current=(name==CURRENT["MySQL"]),
alternate=(name==EDX["MySQL"]),
)
cal.gap_line()
# elasticsearch releases
cal.section_note("https://www.elastic.co/support/eol")
es_releases = [
# ('1.5', 2015, 3, 2016, 9),
# ('1.7', 2015, 7, 2017, 1),
# ('2.4', 2016, 8, 2018, 2),
# ('5.6', 2017, 9, 2019, 3),
# ('6.8', 2019, 5, 2020, 11),
# ('7.8', 2020, 6, 2021, 12),
('7.10', 2020, 11, 2022, 5),
('7.11', 2021, 2, 2022, 8),
('7.12', 2021, 3, 2022, 9),
('7.13', 2021, 5, 2022, 11),
('7.17', 2022, 2, 2025, 1),
('8.15', 2022, 2, 2026, 2),
]
for name, syear, smonth, eyear, emonth in es_releases:
eyear, emonth = validate_version_date("ElasticSearch", name, eyear, emonth)
cal.bar(
f"Elasticsearch {name}",
start=(syear, smonth),
end=(eyear, emonth),
color="#4595ba",
current=(name==CURRENT["Elasticsearch"]),
alternate=(name==EDX["Elasticsearch"]),
)
cal.gap_line()
# Redis
cal.section_note("https://docs.redis.com/latest/rs/administering/product-lifecycle/#endoflife-schedule")
# https://endoflife.date/redis
redis_releases = [
('6.0', 2020, 5, 2023, 8),
('6.2', 2021, 8, 2024, 8),
('7.0', 2022, 4, 2024, 7),
('7.2', 2023, 8, 2024, 8),
('7.4', 2024, 7, 2025, 7),
]
for name, syear, smonth, eyear, emonth in redis_releases:
eyear, emonth = validate_version_date("Redis", name, eyear, emonth)
cal.bar(
f"Redis {name}",
start=(syear, smonth),
end=(eyear, emonth),
color="#963029",
text_color="white",
current=(name==CURRENT["Redis"]),
alternate=(name==EDX["Redis"]),
)
cal.gap_line()
# ruby
cal.section_note("https://www.ruby-lang.org/en/downloads/branches/")
ruby_releases = [
#('2.3', 2015, 12, 2019, 3),
#('2.4', 2016, 12, 2020, 3),
#('2.5', 2017, 12, 2021, 3),
#('2.6', 2018, 12, 2022, 3),
('2.7', 2019, 12, 2023, 3),
('3.0', 2020, 12, 2024, 3),
('3.1', 2021, 12, 2025, 3),
('3.2', 2022, 12, 2026, 3),
('3.3', 2023, 12, 2027, 3),
]
for name, syear, smonth, eyear, emonth, *more in ruby_releases:
eyear, emonth = validate_version_date("Ruby", name, eyear, emonth)
cal.bar(
f"Ruby {name}",
start=(syear, smonth),
end=(eyear, emonth),
color="#DE3F24",
current=(name==CURRENT["Ruby"]),
alternate=(name==EDX["Ruby"]),
note=(more[0] if more else None),
)
cal.gap_line()
cal.text_line("")
cal.footnote_lines()
cal.gap_line()
cal.text_line("Created by https://github.com/openedx/repo-tools/blob/master/barcalendar.py")
cal.write()