-
-
Notifications
You must be signed in to change notification settings - Fork 940
Replace local release-cycle.json with PEPs repo version #1685
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?
Changes from all commits
9edafb0
bf47e6d
0dec214
0e5cb84
51829e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,9 @@ | |||||||||||
| import csv | ||||||||||||
| import datetime as dt | ||||||||||||
| import json | ||||||||||||
| from functools import cache | ||||||||||||
| from pathlib import Path | ||||||||||||
| from urllib.request import urlopen | ||||||||||||
|
|
||||||||||||
| import jinja2 | ||||||||||||
|
|
||||||||||||
|
|
@@ -37,12 +40,17 @@ def parse_version(ver: str) -> list[int]: | |||||||||||
| return [int(i) for i in ver["key"].split(".")] | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @cache | ||||||||||||
| def get_versions() -> dict[str, dict[str, str | int]]: | ||||||||||||
| with urlopen("https://peps.python.org/api/release-cycle.json") as in_file: | ||||||||||||
| return json.loads(in_file.read().decode("utf-8")) | ||||||||||||
|
Comment on lines
+45
to
+46
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For these one-shot requests, what's the benefit of adding a dependency instead of using the stdlib? If we do add one, my vote is for |
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| class Versions: | ||||||||||||
| """For converting JSON to CSV and SVG.""" | ||||||||||||
|
|
||||||||||||
| def __init__(self, *, limit_to_active=False, special_py27=False) -> None: | ||||||||||||
| with open("include/release-cycle.json", encoding="UTF-8") as in_file: | ||||||||||||
| self.versions = json.load(in_file) | ||||||||||||
| self.versions = get_versions() | ||||||||||||
|
|
||||||||||||
| # Generate a few additional fields | ||||||||||||
| for key, version in self.versions.items(): | ||||||||||||
|
|
@@ -197,6 +205,8 @@ def main() -> None: | |||||||||||
|
|
||||||||||||
| versions = Versions() | ||||||||||||
| assert len(versions.versions) > 10 | ||||||||||||
| Path("include").mkdir(exist_ok=True) | ||||||||||||
|
|
||||||||||||
| versions.write_csv() | ||||||||||||
| versions.write_svg(args.today, "include/release-cycle-all.svg") | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||||
| import json | ||||||||||||
| from urllib.request import urlopen | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
| extensions = [ | ||||||||||||
| 'notfound.extension', | ||||||||||||
|
|
@@ -178,8 +179,8 @@ | |||||||||||
|
|
||||||||||||
| # Dynamically expose the Python version associated with the "main" branch. | ||||||||||||
| # Exactly one entry in ``release-cycle.json`` should have ``"branch": "main"``. | ||||||||||||
| with open("include/release-cycle.json", encoding="UTF-8") as _f: | ||||||||||||
| _cycle = json.load(_f) | ||||||||||||
| with urlopen("https://peps.python.org/api/release-cycle.json") as _f: | ||||||||||||
| _cycle = json.loads(_f.read().decode("utf-8")) | ||||||||||||
hugovk marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+182
to
+183
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
| _main_version = next( | ||||||||||||
| version for version, data in _cycle.items() if data.get("branch") == "main" | ||||||||||||
|
|
||||||||||||
This file was deleted.
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.