-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Generate a release schedule as an .ics file
#4705
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
| 'BEGIN:VEVENT', | ||
| f'SUMMARY:Python {release.stage}', | ||
| f'DTSTART;VALUE=DATE:{release.date.strftime("%Y%m%d")}', | ||
| f'UID:python-{normalised_stage}@releases.python.org', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| f'UID:python-{normalised_stage}@releases.python.org', | |
| f'UID:python-{normalised_stage}@python.org', |
| ] | ||
| for version, release in all_releases: | ||
| normalised_stage = release.stage.casefold().replace(' ', '') | ||
| note = (f'DESCRIPTION:Note: {release.note}',) if release.note else () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DESCRIPTION is a TEXT type:
https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.1.5
TEXT needs to escape some characters:
ESCAPED-CHAR = ("\\" / "\;" / "\," / "\N" / "\n")
https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.11
| pep_number = python_releases.metadata[version].pep | ||
| lines += ( | ||
| 'BEGIN:VEVENT', | ||
| f'SUMMARY:Python {release.stage}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUMMARY is also TEXT, but maybe we can assume this will never need escaping? Although it'd be safer to run it through an escape function.
https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.1.12
| ('3.14.0 alpha 1', 'python-3.14.0alpha1@releases.python.org'), | ||
| ('3.14.0 beta 2', 'python-3.14.0beta2@releases.python.org'), | ||
| ('3.14.0 candidate 3', 'python-3.14.0candidate3@releases.python.org'), | ||
| ('3.14.1', 'python-3.14.1@releases.python.org'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ('3.14.0 alpha 1', 'python-3.14.0alpha1@releases.python.org'), | |
| ('3.14.0 beta 2', 'python-3.14.0beta2@releases.python.org'), | |
| ('3.14.0 candidate 3', 'python-3.14.0candidate3@releases.python.org'), | |
| ('3.14.1', 'python-3.14.1@releases.python.org'), | |
| ('3.14.0 alpha 1', 'python-3.14.0alpha1@python.org'), | |
| ('3.14.0 beta 2', 'python-3.14.0beta2@python.org'), | |
| ('3.14.0 candidate 3', 'python-3.14.0candidate3@python.org'), | |
| ('3.14.1', 'python-3.14.1@python.org'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're missing test coverage of release_mangement/:
https://app.codecov.io/gh/python/peps/pull/4705/tree
Please include the .coveragerc and pytest.ini changes (or similar) from the original PR.
| global _PYTHON_RELEASES | ||
| if _PYTHON_RELEASES is not None: | ||
| return _PYTHON_RELEASES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think chucking a @cache decorator on the function (from the original PR) is much cleaner than six lines to manage a global variable.
| 'END:VCALENDAR', | ||
| '', | ||
| ) | ||
| return '\n'.join(lines) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have CRLF line endings: https://datatracker.ietf.org/doc/html/rfc5545#section-3.1
| return '\n'.join(lines) | |
| return '\r\n'.join(lines) |
This is derived from Hugo's #4704; see that PR for context.
This PR is an attempt to implement @sethmlarson's suggestion -- attempting to do this via review comments wasn't really going to work!
The ICS generation is now much simpler with no dependencies, simply outputting the required strings. I've also limited past events to 7 years to keep the file size smaller (for ~18months of pre-releases and a five-year lifespan). Realistically this could be much shorter, but I've been conservative.
A
📚 Documentation preview 📚: https://pep-previews--4705.org.readthedocs.build/