diff --git a/conf.py b/conf.py index bedd99c42..9bfe2305c 100644 --- a/conf.py +++ b/conf.py @@ -1,3 +1,5 @@ +import json + extensions = [ 'notfound.extension', 'sphinx.ext.extlinks', @@ -165,8 +167,17 @@ # sphinx-notfound-page notfound_urls_prefix = "/" +# 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) + +_main_version = next( + version for version, data in _cycle.items() if data.get("branch") == "main" +) + # prolog and epilogs -rst_prolog = """ +rst_prolog = f""" .. |draft| replace:: This is part of a **Draft** of the Python Contributor's Guide. Text in square brackets are notes about content to fill in. @@ -183,6 +194,8 @@ .. _Refactoring the DevGuide: https://discuss.python.org/t/refactoring-the-devguide-into-a-contribution-guide/63409 +.. |main_version| replace:: {_main_version} + """ # sphinx.ext.extlinks diff --git a/versions.rst b/versions.rst index 8cfd259f8..0a52829c2 100644 --- a/versions.rst +++ b/versions.rst @@ -5,7 +5,7 @@ Status of Python versions ========================= -The ``main`` branch is currently the future Python 3.14, and is the only +The ``main`` branch is currently the future Python |main_version|, and is the only branch that accepts new features. The latest release for each Python version can be found on the `download page `_.