Skip to content

Commit 4705126

Browse files
corneliusroemerhugovkezio-melotti
authored
Dynamically substitute main version in versions.rst from release-cycle.json (#1583)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
1 parent 3a8b71e commit 4705126

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

conf.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import json
2+
13
extensions = [
24
'notfound.extension',
35
'sphinx.ext.extlinks',
@@ -165,8 +167,17 @@
165167
# sphinx-notfound-page
166168
notfound_urls_prefix = "/"
167169

170+
# Dynamically expose the Python version associated with the "main" branch.
171+
# Exactly one entry in ``release-cycle.json`` should have ``"branch": "main"``.
172+
with open("include/release-cycle.json", encoding="UTF-8") as _f:
173+
_cycle = json.load(_f)
174+
175+
_main_version = next(
176+
version for version, data in _cycle.items() if data.get("branch") == "main"
177+
)
178+
168179
# prolog and epilogs
169-
rst_prolog = """
180+
rst_prolog = f"""
170181
.. |draft| replace::
171182
This is part of a **Draft** of the Python Contributor's Guide.
172183
Text in square brackets are notes about content to fill in.
@@ -183,6 +194,8 @@
183194
184195
.. _Refactoring the DevGuide: https://discuss.python.org/t/refactoring-the-devguide-into-a-contribution-guide/63409
185196
197+
.. |main_version| replace:: {_main_version}
198+
186199
"""
187200

188201
# sphinx.ext.extlinks

versions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Status of Python versions
66
=========================
77

8-
The ``main`` branch is currently the future Python 3.14, and is the only
8+
The ``main`` branch is currently the future Python |main_version|, and is the only
99
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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy