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

Skip to content

Python version status: show when bugfix releases become security releases. #1529

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion _tools/generate_release_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def __init__(self) -> None:
# Generate a few additional fields
for key, version in self.versions.items():
version["key"] = key
version["first_release_date"] = parse_date(version["first_release"])
version["first_release_date"] = r1 = parse_date(version["first_release"])
version["start_security_date"] = r1 + dt.timedelta(days=2 * 365)
version["end_of_life_date"] = parse_date(version["end_of_life"])
self.sorted_versions = sorted(
self.versions.values(),
Expand Down
100 changes: 81 additions & 19 deletions _tools/release_cycle_template.svg.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,87 @@
<!-- Colourful blob with a label -->
{% set start_x = date_to_x(version.first_release_date) %}
{% set end_x = date_to_x(version.end_of_life_date) %}
{% set mid_x = (start_x + end_x) / 2 %}
<rect
class="release-cycle-blob release-cycle-blob-{{ version.status }}"
x="{{ start_x * SCALE }}"
y="{{ (y - 1) * SCALE }}"
width="{{ (end_x - start_x) * SCALE }}"
height="{{ 1.25 * SCALE }}"
rx="0.25em"
ry="0.25em"
/>
<text
class="release-cycle-blob-label release-cycle-blob-{{ version.status }}"
x="{{ mid_x * SCALE }}"
y="{{ (y - 0.1) * SCALE }}"
font-size="{{ SCALE * 0.75 }}"
text-anchor="middle"
>
{{ version.status }}
</text>

{% if version.status == "bugfix" %}
<!-- bugfix status needs a security tail.
Draw the rectangle with two path elements instead.
Thanks Claude.ai for the conversion.
-->
{% set half_x = date_to_x(version.start_security_date) %}
{% set height = 1.25 * SCALE %}
{% set left_width = (half_x - start_x) * SCALE %}
{% set right_width = (end_x - half_x) * SCALE %}
{% set left_x = start_x * SCALE %}
{% set middle_x = half_x * SCALE %}
{% set right_x = half_x * SCALE %}
{% set recty = (y - 1) * SCALE %}
{% set radius_value = 0.25 * SCALE %}

<path
class="release-cycle-blob release-cycle-blob-bugfix"
d="
M{{ left_x + radius_value }},{{ recty }}
Q{{ left_x }},{{ recty }} {{ left_x }},{{ recty + radius_value }}
V{{ recty + height - radius_value }}
Q{{ left_x }},{{ recty + height }} {{ left_x + radius_value }},{{ recty + height }}
H{{ middle_x }}
V{{ recty }}
Z
Comment on lines +80 to +86
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this rather confusing.
Once the final style is decided, would you mind me simplifying & adding comments? Unless you want to do it of course.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course it's fine to simplify and comment. One way to simplify is to forgo the rounded corners. This <path> element was the only way to give it two rounded corners and two square corners.

"
/>
<text
class="release-cycle-blob-label release-cycle-blob-bugfix"
x="{{ (start_x + half_x) / 2 * SCALE }}"
y="{{ (y - 0.1) * SCALE }}"
font-size="{{ SCALE * 0.75 }}"
text-anchor="middle"
>
bugfix
</text>

<path
class="release-cycle-blob release-cycle-blob-security"
d="
M{{ right_x }},{{ recty }}
H{{ right_x + right_width - radius_value }}
Q{{ right_x + right_width }},{{ recty }} {{ right_x + right_width }},{{ recty + radius_value }}
V{{ recty + height - radius_value }}
Q{{ right_x + right_width }},{{ recty + height }} {{ right_x + right_width - radius_value }},{{ recty + height }}
H{{ right_x }}
V{{ recty }}
Z
"
/>
<text
class="release-cycle-blob-label release-cycle-blob-security"
x="{{ (half_x + end_x) / 2 * SCALE }}"
y="{{ (y - 0.1) * SCALE }}"
font-size="{{ SCALE * 0.75 }}"
text-anchor="middle"
>
security
</text>
{% else %}
<!-- Most statuses only need a simple rectangle with text. -->
<rect
class="release-cycle-blob release-cycle-blob-{{ version.status }}"
x="{{ start_x * SCALE }}"
y="{{ (y - 1) * SCALE }}"
width="{{ (end_x - start_x) * SCALE }}"
height="{{ 1.25 * SCALE }}"
rx="0.25em"
ry="0.25em"
/>
<text
class="release-cycle-blob-label release-cycle-blob-{{ version.status }}"
x="{{ (start_x + end_x) / 2 * SCALE }}"
y="{{ (y - 0.1) * SCALE }}"
font-size="{{ SCALE * 0.75 }}"
text-anchor="middle"
>
{{ version.status }}
</text>
{% endif %}
{% endfor %}

<!-- A line for today -->
Expand Down
Loading