Skip to content

Commit 3e65c0c

Browse files
hugovkencukou
andauthored
Make release cycle charts reusable (#1708)
Co-authored-by: Petr Viktorin <[email protected]>
1 parent e583bd3 commit 3e65c0c

File tree

7 files changed

+160
-142
lines changed

7 files changed

+160
-142
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,5 @@ celerybeat-schedule
9090
# Generated CSV and SVG files
9191
include/branches.csv
9292
include/end-of-life.csv
93-
include/release-cycle.svg
94-
include/release-cycle-all.svg
93+
_static/release-cycle.svg
94+
_static/release-cycle-all.svg

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ 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 \
26-
include/release-cycle.svg
25+
_static/release-cycle-all.svg \
26+
_static/release-cycle.svg
2727

2828
.PHONY: help
2929
help:

_static/devguide_overrides.css

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,102 +6,6 @@
66
height: 110px;
77
}
88

9-
/* Release cycle chart */
10-
11-
.release-cycle-chart {
12-
width: 100%;
13-
}
14-
15-
.release-cycle-chart .release-cycle-year-line {
16-
stroke: var(--color-foreground-primary);
17-
stroke-width: 0.8px;
18-
opacity: 75%;
19-
}
20-
21-
.release-cycle-chart .release-cycle-year-text {
22-
fill: var(--color-foreground-primary);
23-
}
24-
25-
.release-cycle-chart .release-cycle-today-line {
26-
stroke: var(--color-brand-primary);
27-
stroke-width: 1.6px;
28-
}
29-
30-
.release-cycle-chart .release-cycle-row-shade {
31-
fill: var(--color-background-item);
32-
opacity: 50%;
33-
}
34-
35-
.release-cycle-chart .release-cycle-version-label {
36-
fill: var(--color-foreground-primary);
37-
}
38-
39-
.release-cycle-chart .release-cycle-blob {
40-
stroke-width: 1.6px;
41-
/* default colours, overridden below for individual statuses */
42-
fill: var(--color-background-primary);
43-
stroke: var(--color-foreground-primary);
44-
}
45-
46-
.release-cycle-chart .release-cycle-blob-label {
47-
/* white looks good on both light & dark */
48-
fill: white;
49-
}
50-
51-
.release-cycle-chart .release-cycle-blob-label.release-cycle-status-security,
52-
.release-cycle-chart .release-cycle-blob-label.release-cycle-status-bugfix {
53-
/* but use black to improve contrast for lighter backgrounds */
54-
fill: black;
55-
}
56-
57-
.release-cycle-chart .release-cycle-blob-label.release-cycle-status-end-of-life,
58-
.release-cycle-chart .release-cycle-blob-label.release-cycle-status-prerelease,
59-
.release-cycle-chart .release-cycle-blob-label.release-cycle-status-feature {
60-
/* and FG when it's not in a blob */
61-
fill: var(--color-foreground-primary);
62-
}
63-
64-
.release-cycle-chart .release-cycle-status-end-of-life {
65-
--status-bg-color: #DD2200;
66-
--status-border-color: #FF8888;
67-
}
68-
69-
.release-cycle-chart .release-cycle-status-security {
70-
--status-bg-color: #FFDD44;
71-
--status-border-color: #FF8800;
72-
}
73-
74-
.release-cycle-chart .release-cycle-status-bugfix {
75-
--status-bg-color: #00DD22;
76-
--status-border-color: #008844;
77-
}
78-
79-
.release-cycle-chart .release-cycle-status-prerelease {
80-
--status-bg-color: teal;
81-
--status-border-color: darkgreen;
82-
}
83-
84-
.release-cycle-chart .release-cycle-status-feature {
85-
--status-bg-color: #2222EE;
86-
--status-border-color: #008888;
87-
}
88-
89-
.release-cycle-chart .release-cycle-blob {
90-
fill: var(--status-bg-color);
91-
stroke: transparent;
92-
}
93-
94-
.release-cycle-chart .release-cycle-blob-full {
95-
fill: var(--status-bg-color);
96-
stroke: var(--status-border-color);
97-
}
98-
99-
.release-cycle-chart .release-cycle-border {
100-
fill: transparent;
101-
stroke: var(--status-border-color);
102-
stroke-width: 1.6px;
103-
}
104-
1059
.good pre {
10610
border-left: 3px solid rgba(74, 182, 93, 1);
10711
}

_tools/generate_release_cycle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ def main() -> None:
208208
Path("include").mkdir(exist_ok=True)
209209

210210
versions.write_csv()
211-
versions.write_svg(args.today, "include/release-cycle-all.svg")
211+
versions.write_svg(args.today, "_static/release-cycle-all.svg")
212212

213213
versions = Versions(limit_to_active=True, special_py27=True)
214-
versions.write_svg(args.today, "include/release-cycle.svg")
214+
versions.write_svg(args.today, "_static/release-cycle.svg")
215215

216216

217217
if __name__ == "__main__":

_tools/release_cycle_template.svg.jinja

Lines changed: 150 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,121 @@
44
class="release-cycle-chart"
55
viewBox="0 0 {{ diagram_width }} {{ diagram_height }}"
66
>
7+
<style>
8+
/* Embedded styles for standalone viewing */
9+
.release-cycle-chart {
10+
color-scheme: light;
11+
12+
{# Copy vars from Furo theme if present #}
13+
{% for varname, default in {
14+
'color-foreground-primary': 'light-dark(#333, #fff)',
15+
'color-background-primary': 'light-dark(#fff, #333)',
16+
'color-brand-primary': '#4B8BBE',
17+
'color-background-item': '#e0e0e0',
18+
}.items() %}
19+
--svg-{{varname}}: var(--{{varname}}, {{default}});
20+
{% endfor %}
21+
22+
font-family: var(
23+
--font-stack,
24+
-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica,
25+
Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji);
26+
width: 100%;
27+
28+
--blob-border-width: 1.6px;
29+
}
30+
.background {
31+
fill: var(--svg-color-background-primary);
32+
}
33+
.release-cycle-year-line {
34+
stroke: var(--svg-color-foreground-primary);
35+
stroke-width: 0.8px;
36+
opacity: 75%;
37+
}
38+
.release-cycle-today-line {
39+
stroke: var(--svg-color-brand-primary);
40+
stroke-width: var(--blob-border-width);
41+
}
42+
.release-cycle-row-shade {
43+
fill: var(--svg-color-background-item);
44+
opacity: 50%;
45+
}
46+
.release-cycle-blob {
47+
stroke-width: var(--blob-border-width);
48+
}
49+
.text-main {
50+
fill: var(--svg-color-foreground-primary);
51+
52+
/* use specific colours on known backgrounds */
53+
&amp;.release-cycle-status-security,
54+
&amp;.release-cycle-status-bugfix {
55+
fill: black;
56+
}
57+
}
58+
.text-outline {
59+
/* an outline of the background color, in case it's not set
60+
correctly */
61+
fill: transparent;
62+
stroke: var(--svg-color-background-primary);
63+
stroke-width: var(--blob-border-width);
64+
65+
/* use specific colours on known backgrounds */
66+
&amp;.release-cycle-status-security,
67+
&amp;.release-cycle-status-bugfix {
68+
stroke: var(--status-bg-color);
69+
}
70+
}
71+
.release-cycle-status-end-of-life {
72+
--status-bg-color: #DD2200;
73+
--status-border-color: #FF8888;
74+
}
75+
.release-cycle-status-security {
76+
--status-bg-color: #FFDD44;
77+
--status-border-color: #FF8800;
78+
}
79+
.release-cycle-status-bugfix {
80+
--status-bg-color: #00DD22;
81+
--status-border-color: #008844;
82+
}
83+
.release-cycle-status-prerelease {
84+
--status-bg-color: teal;
85+
--status-border-color: darkgreen;
86+
}
87+
.release-cycle-status-feature {
88+
--status-bg-color: #2222EE;
89+
--status-border-color: #008888;
90+
}
91+
.release-cycle-blob {
92+
fill: var(--status-bg-color);
93+
stroke: transparent;
94+
}
95+
.release-cycle-blob-full {
96+
fill: var(--status-bg-color);
97+
stroke: var(--status-border-color);
98+
}
99+
.release-cycle-border {
100+
fill: transparent;
101+
stroke: var(--status-border-color);
102+
stroke-width: var(--blob-border-width);
103+
}
104+
</style>
7105
<defs>
8106
<linearGradient id="release-cycle-mask-gradient-{{ id_key }}">
9107
<stop stop-color="black" offset="0%" />
10108
<stop stop-color="white" offset="100%" />
11109
</linearGradient>
12110
</defs>
13111

112+
<rect
113+
class="background"
114+
x="0"
115+
y="0"
116+
width="{{ diagram_width }}"
117+
height="{{ diagram_height }}"
118+
/>
119+
14120
{% for version in versions %}
15121
{% set y = version.y * line_height %}
16-
17122
{% if version.y % 2 %}
18123
<!-- Row shading -->
19124
<rect
@@ -28,7 +133,7 @@
28133

29134
{% for year in years %}
30135
<text
31-
class="release-cycle-year-text"
136+
class="release-cycle-year-text text-main"
32137
x="{{ (year_to_x(year) + year_to_x(year + 1)) / 2 }}"
33138
y="{{ diagram_height - line_height }}"
34139
font-size="{{ SCALE * 0.75 }}"
@@ -74,16 +179,14 @@
74179
</mask>
75180

76181
{% for version in versions %}
77-
<!-- Colourful blob with a label. -->
182+
<!-- Colourful blob. -->
78183

79184
{% set top_y = version.y * line_height - 1 * SCALE %}
80185
{% set height = 1.25 * SCALE %}
81186
{% set start_x = date_to_x(version.first_release_date) %}
82187
{% set end_x = date_to_x(version.end_of_life_date) %}
83188
{% set radius = 0.25 * SCALE %}
84189

85-
{% set small_text_y = version.y * line_height - 0.1 * SCALE %}
86-
87190
<!-- bugfix/security blobs need to be split between the two phases.
88191
Draw the rectangle with two path elements instead.
89192
Thanks Claude.ai for the initial conversion.
@@ -151,47 +254,58 @@
151254
mask="url(#release-cycle-mask-{{ id_key }})"
152255
/>
153256
{% endif %}
257+
{% endfor %}
258+
259+
<!-- A line for today -->
260+
<line
261+
class="release-cycle-today-line"
262+
x1="{{ date_to_x(today) }}"
263+
x2="{{ date_to_x(today) }}"
264+
y1="0"
265+
y2="{{ diagram_height - line_height }}"
266+
font-size="{{ SCALE }}"
267+
/>
268+
269+
{% for version in versions %}
270+
<!-- Label for colourful blob -->
271+
272+
{% set start_x = date_to_x(version.first_release_date) %}
273+
{% set end_x = date_to_x(version.end_of_life_date) %}
274+
{% set middle_x = ([end_x, date_to_x(version.start_security_date)]|min) %}
275+
{% set small_text_y = version.y * line_height - 0.1 * SCALE %}
154276

155277
<!-- Add text before/after/inside the blob -->
156-
<text
157-
class="release-cycle-blob-label release-cycle-status-{{ version.status }}"
158-
font-size="{{ SCALE * 0.75 }}"
159-
y="{{ small_text_y }}"
160-
{% if version.status == "bugfix" %}
161-
x="{{ (start_x + middle_x) / 2 }}"
162-
text-anchor="middle"
163-
{% elif version.status == "security" %}
164-
x="{{ (middle_x + end_x) / 2 }}"
165-
text-anchor="middle"
166-
{% elif version.status == "end-of-life" %}
167-
x="{{ end_x + (0.25 * SCALE) }}"
168-
text-anchor="start"
169-
{% else %}
170-
x="{{ start_x - (0.25 * SCALE) }}"
171-
text-anchor="end"
172-
{% endif %}
173-
>
174-
{{ version.status }}
175-
</text>
278+
{% for cls in ('text-outline', 'text-main') %}
279+
<text
280+
class="release-cycle-blob-label {{cls}} release-cycle-status-{{ version.status }}"
281+
font-size="{{ SCALE * 0.75 }}"
282+
y="{{ small_text_y }}"
283+
{% if version.status == "bugfix" %}
284+
x="{{ (start_x + middle_x) / 2 }}"
285+
text-anchor="middle"
286+
{% elif version.status == "security" %}
287+
x="{{ (middle_x + end_x) / 2 }}"
288+
text-anchor="middle"
289+
{% elif version.status == "end-of-life" %}
290+
x="{{ end_x + (0.25 * SCALE) }}"
291+
text-anchor="start"
292+
{% else %}
293+
x="{{ start_x - (0.25 * SCALE) }}"
294+
text-anchor="end"
295+
{% endif %}
296+
>
297+
{{ version.status }}
298+
</text>
299+
{% endfor %}
176300

177301
<!-- Legend on the left -->
178302
<text
179-
class="release-cycle-version-label"
303+
class="release-cycle-version-label text-main"
180304
x="{{ 0.5 * SCALE }}"
181305
y="{{ version.y * line_height }}"
182306
font-size="{{ SCALE }}"
183307
>
184308
Python {{ version.key }}
185309
</text>
186310
{% endfor %}
187-
188-
<!-- A line for today -->
189-
<line
190-
class="release-cycle-today-line"
191-
x1="{{ date_to_x(today) }}"
192-
x2="{{ date_to_x(today) }}"
193-
y1="0"
194-
y2="{{ diagram_height - line_height }}"
195-
font-size="{{ SCALE }}"
196-
/>
197311
</svg>

make.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if ($target -Eq "clean") {
6565
$BUILDDIR,
6666
$_VENV_DIR,
6767
"include/branches.csv", "include/end-of-life.csv",
68-
"include/release-cycle.svg", "include/release-cycle-all.svg"
68+
"_static/release-cycle.svg", "_static/release-cycle-all.svg"
6969
)
7070
foreach ($item in $ToClean) {
7171
if (Test-Path -Path $item) {

0 commit comments

Comments
 (0)