Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc4f279

Browse files
committed
Two graphs
1 parent 2926a88 commit dc4f279

File tree

5 files changed

+39
-9
lines changed

5 files changed

+39
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,4 @@ celerybeat-schedule
9191
include/branches.csv
9292
include/end-of-life.csv
9393
include/release-cycle.svg
94+
include/release-cycle-all.svg

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ REQUIREMENTS = requirements.txt
2222
_ALL_SPHINX_OPTS = --jobs $(JOBS) $(SPHINXOPTS)
2323
_RELEASE_CYCLE = include/branches.csv \
2424
include/end-of-life.csv \
25+
include/release-cycle-all.svg \
2526
include/release-cycle.svg
2627

2728
.PHONY: help

_tools/generate_release_cycle.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def parse_date(date_str: str) -> dt.date:
2828
class Versions:
2929
"""For converting JSON to CSV and SVG."""
3030

31-
def __init__(self) -> None:
31+
def __init__(self, limit_to_active=False) -> None:
3232
with open("include/release-cycle.json", encoding="UTF-8") as in_file:
3333
self.versions = json.load(in_file)
3434

@@ -38,6 +38,20 @@ def __init__(self) -> None:
3838
version["first_release_date"] = r1 = parse_date(version["first_release"])
3939
version["start_security_date"] = r1 + dt.timedelta(days=2 * 365)
4040
version["end_of_life_date"] = parse_date(version["end_of_life"])
41+
42+
if limit_to_active:
43+
cutoff = min(
44+
version["first_release_date"]
45+
for version in self.versions.values()
46+
if version["status"] != 'end-of-life'
47+
)
48+
self.versions = {
49+
key: version
50+
for key, version in self.versions.items()
51+
if version["end_of_life_date"] >= cutoff
52+
}
53+
54+
4155
self.sorted_versions = sorted(
4256
self.versions.values(),
4357
key=lambda v: [int(i) for i in v["key"].split(".")],
@@ -69,7 +83,7 @@ def write_csv(self) -> None:
6983
csv_file.writeheader()
7084
csv_file.writerows(versions.values())
7185

72-
def write_svg(self, today: str) -> None:
86+
def write_svg(self, today: str, out_path: str) -> None:
7387
"""Output SVG file."""
7488
env = jinja2.Environment(
7589
loader=jinja2.FileSystemLoader("_tools/"),
@@ -117,7 +131,7 @@ def format_year(year: int) -> str:
117131
return f"'{year % 100:02}"
118132

119133
with open(
120-
"include/release-cycle.svg", "w", encoding="UTF-8", newline="\n"
134+
out_path, "w", encoding="UTF-8", newline="\n"
121135
) as f:
122136
template.stream(
123137
SCALE=SCALE,
@@ -146,8 +160,13 @@ def main() -> None:
146160
args = parser.parse_args()
147161

148162
versions = Versions()
163+
print(versions.versions.keys())
164+
assert len(versions.versions) > 10
149165
versions.write_csv()
150-
versions.write_svg(args.today)
166+
versions.write_svg(args.today, "include/release-cycle-all.svg")
167+
168+
versions = Versions(limit_to_active=True)
169+
versions.write_svg(args.today, "include/release-cycle.svg")
151170

152171

153172
if __name__ == "__main__":

make.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ if ($target -Eq "clean") {
6464
$ToClean = @(
6565
$BUILDDIR,
6666
$_VENV_DIR,
67-
"include/branches.csv", "include/end-of-life.csv", "include/release-cycle.svg"
67+
"include/branches.csv", "include/end-of-life.csv",
68+
"include/release-cycle.svg", "include/release-cycle-all.svg"
6869
)
6970
foreach ($item in $ToClean) {
7071
if (Test-Path -Path $item) {

versions.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ branch that accepts new features. The latest release for each Python
1010
version can be found on the `download page <https://www.python.org/downloads/>`_.
1111

1212

13-
Python release cycle
14-
====================
15-
1613
.. raw:: html
1714
:file: include/release-cycle.svg
1815

19-
Another useful visualization is `endoflife.date/python <https://endoflife.date/python>`_.
16+
(See :ref:`below <versions-chart-all>` for a chart with older versions.
17+
Another useful visualization is `endoflife.date/python <https://endoflife.date/python>`_.)
18+
2019

2120
Supported versions
2221
==================
@@ -40,6 +39,15 @@ Unsupported versions
4039
:file: include/end-of-life.csv
4140

4241

42+
.. _versions-chart-all:
43+
44+
Full chart
45+
==========
46+
47+
.. raw:: html
48+
:file: include/release-cycle-all.svg
49+
50+
4351
Status key
4452
==========
4553

0 commit comments

Comments
 (0)