-
-
Notifications
You must be signed in to change notification settings - Fork 27
Add extension to generate a table of future meeting dates and times #186
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
Merged
StanFromIreland
merged 9 commits into
python:main
from
StanFromIreland:meetings-extension
Mar 27, 2026
+134
−9
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
924a758
Add extension to generate a table of future meeting dates and times
StanFromIreland fc1731c
refatcior a 'lil
StanFromIreland 14e256f
Fix when cached build exists
StanFromIreland 5176a47
Linkcheck.
StanFromIreland f3ce972
Hugo's review (bar typing...)
StanFromIreland 5bbe988
RTD builds with 3.11.12...?
StanFromIreland 7633f95
Hugo's review
StanFromIreland 01cb26b
Doc update
StanFromIreland 11d219b
Apply suggestions from code review
StanFromIreland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ version: 2 | |
| build: | ||
| os: ubuntu-22.04 | ||
| tools: | ||
| python: "3.11" | ||
| python: "3.14" | ||
|
|
||
| python: | ||
| install: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| """Sphinx extension to generate a list of upcoming meeting dates.""" | ||
|
|
||
| import datetime as dt | ||
| import os | ||
|
|
||
| from docutils import nodes | ||
| from sphinx.util.docutils import SphinxDirective | ||
|
|
||
|
|
||
| def utc_hour(date): | ||
| if 4 <= date.month <= 10: | ||
| # Daylight saving time in Europe and the US | ||
| return 19 if date.month % 2 == 0 else 16 | ||
| else: | ||
| # Winter time in Europe and the US | ||
| return 20 if date.month % 2 == 0 else 17 | ||
|
|
||
|
|
||
| def first_tuesday(year, month): | ||
| first = dt.date(year, month, 1) | ||
| days_ahead = (1 - first.weekday()) % 7 | ||
| return first + dt.timedelta(days=days_ahead) | ||
|
|
||
|
|
||
| def upcoming_meetings(today, count): | ||
| meetings = [] | ||
| year, month = today.year, today.month | ||
| while len(meetings) < count: | ||
| meeting_date = first_tuesday(year, month) | ||
| if meeting_date >= today: | ||
| meetings.append((meeting_date, utc_hour(meeting_date))) | ||
| month += 1 | ||
| if month > 12: | ||
| month = 1 | ||
| year += 1 | ||
| return meetings | ||
|
|
||
|
|
||
| def past_meetings(today, count): | ||
| meetings = [] | ||
| year, month = today.year, today.month | ||
| while len(meetings) < count: | ||
| meeting_date = first_tuesday(year, month) | ||
| if meeting_date < today: | ||
| meetings.append((meeting_date, utc_hour(meeting_date))) | ||
| month -= 1 | ||
| if month < 1: | ||
| month = 12 | ||
| year -= 1 | ||
| meetings.reverse() | ||
| return meetings | ||
|
|
||
|
|
||
| class MeetingDatesDirective(SphinxDirective): | ||
| has_content = False | ||
|
|
||
| def run(self): | ||
| bullets = nodes.bullet_list() | ||
| for date, hour in upcoming_meetings(dt.date.today(), 6): | ||
| item = nodes.list_item() | ||
| text = f"{date.strftime('%B %d, %Y')} - {hour:02d}:00 UTC" | ||
| url = f"https://arewemeetingyet.com/UTC/{date.isoformat()}/{hour}:00/Docs Community Meeting" | ||
|
|
||
| paragraph = nodes.paragraph() | ||
| ref = nodes.reference("", text, refuri=url) | ||
| paragraph += ref | ||
| item += paragraph | ||
| bullets += item | ||
|
|
||
| return [bullets] | ||
|
|
||
|
|
||
| def generate_ics(app, exception): | ||
| if exception: | ||
| return | ||
|
|
||
| lines = [ | ||
| "BEGIN:VCALENDAR", | ||
| "VERSION:2.0", | ||
| "PRODID:-//Python Docs WG//Meeting dates//EN", | ||
| "X-WR-CALDESC:Python Docs WG meetings from https://docs-community.readthedocs.io/", | ||
| "X-WR-CALNAME:Python Docs WG meetings", | ||
| ] | ||
| today = dt.date.today() | ||
| meetings = past_meetings(today, 12) + upcoming_meetings(today, 12) | ||
| for date, hour in meetings: | ||
| start = dt.datetime(date.year, date.month, date.day, hour, 0, 0) | ||
| end = start + dt.timedelta(hours=1) | ||
| lines += [ | ||
| "BEGIN:VEVENT", | ||
| f"UID:{start.strftime('%Y%m%dT%H%M%SZ')}@python-docs-community", | ||
| f"DTSTAMP:{dt.datetime.now(dt.timezone.utc).strftime('%Y%m%dT%H%M%SZ')}", | ||
| f"DTSTART:{start.strftime('%Y%m%dT%H%M%SZ')}", | ||
| f"DTEND:{end.strftime('%Y%m%dT%H%M%SZ')}", | ||
| "SUMMARY:Python Docs WG", | ||
| f"URL:https://arewemeetingyet.com/UTC/{date.isoformat()}/{hour}:00/Python Docs WG meeting", | ||
| "END:VEVENT", | ||
| ] | ||
| lines += ["END:VCALENDAR"] | ||
| ics = "\r\n".join(lines) + "\r\n" | ||
|
|
||
| with open(os.path.join(app.outdir, "docs-community-meetings.ics"), "w") as f: | ||
| f.write(ics) | ||
|
|
||
|
|
||
| def setup(app): | ||
| app.add_directive("meeting-dates", MeetingDatesDirective) | ||
| app.connect("build-finished", generate_ics) | ||
| return {"version": "1.0", "parallel_read_safe": True} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.