Skip to content

Commit f3ce972

Browse files
Hugo's review (bar typing...)
1 parent 5176a47 commit f3ce972

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

docs/community/monthly-meeting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Upcoming meetings:
1111

1212
.. meeting-dates::
1313

14-
`Download calendar (ICS) </docs-community-meetings.ics>`_
14+
`Download iCalendar file </docs-community-meetings.ics>`_
1515

1616
The agenda and later the meeting minutes are written in the `HackMD <https://hackmd.io/@encukou/pydocswg1>`_.
1717
To edit notes, click the “pencil” or “split view” button on the `HackMD Document <https://hackmd.io/@encukou/pydocswg1>`_.

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@
7474
r"https://plausible.io/docs.python.org",
7575
r"https://plausible.io/packaging.python.org",
7676
r"https://us.pycon.org/2024/registration/category/4",
77+
# Have redirects:
7778
r"https://arewemeetingyet.com/.*",
78-
# Generated at build time
79+
# Generated at build time:
7980
r"/docs-community-meetings.ics",
8081
]
8182

docs/tools/meeting_dates.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def first_tuesday(year, month):
2222
return first + dt.timedelta(days=days_ahead)
2323

2424

25-
def upcoming_meetings(today):
25+
def upcoming_meetings(today, count):
2626
meetings = []
2727
year, month = today.year, today.month
28-
while len(meetings) < 6: # Max of six meeting entries
28+
while len(meetings) < count:
2929
meeting_date = first_tuesday(year, month)
3030
if meeting_date >= today:
3131
meetings.append((meeting_date, utc_hour(meeting_date)))
@@ -36,12 +36,27 @@ def upcoming_meetings(today):
3636
return meetings
3737

3838

39+
def past_meetings(today, count):
40+
meetings = []
41+
year, month = today.year, today.month
42+
while len(meetings) < count:
43+
meeting_date = first_tuesday(year, month)
44+
if meeting_date < today:
45+
meetings.append((meeting_date, utc_hour(meeting_date)))
46+
month -= 1
47+
if month < 1:
48+
month = 12
49+
year -= 1
50+
meetings.reverse()
51+
return meetings
52+
53+
3954
class MeetingDatesDirective(SphinxDirective):
4055
has_content = False
4156

4257
def run(self):
4358
bullets = nodes.bullet_list()
44-
for date, hour in upcoming_meetings(dt.date.today()):
59+
for date, hour in upcoming_meetings(dt.date.today(), 6):
4560
item = nodes.list_item()
4661
text = f"{date.strftime('%B %d, %Y')} - {hour:02d}:00 UTC"
4762
url = f"https://arewemeetingyet.com/UTC/{date.isoformat()}/{hour}:00/Docs Community Meeting"
@@ -64,11 +79,15 @@ def generate_ics(app, exception):
6479
"VERSION:2.0",
6580
"PRODID:-//Python Docs Community//Meeting Dates//EN",
6681
]
67-
for date, hour in upcoming_meetings(dt.date.today()):
82+
today = dt.date.today()
83+
meetings = past_meetings(today, 12) + upcoming_meetings(today, 12)
84+
for date, hour in meetings:
6885
start = dt.datetime(date.year, date.month, date.day, hour, 0, 0)
6986
end = start + dt.timedelta(hours=1)
7087
lines += [
7188
"BEGIN:VEVENT",
89+
f"UID:{start.strftime('%Y%m%dT%H%M%SZ')}@python-docs-community",
90+
f"DTSTAMP:{dt.datetime.now(dt.timezone.utc).strftime("%Y%m%dT%H%M%SZ")}",
7291
f"DTSTART:{start.strftime('%Y%m%dT%H%M%SZ')}",
7392
f"DTEND:{end.strftime('%Y%m%dT%H%M%SZ')}",
7493
"SUMMARY:Docs Community Meeting",

0 commit comments

Comments
 (0)