Skip to content
15 changes: 14 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

extensions = [
'notfound.extension',
'sphinx.ext.extlinks',
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.python.org/downloads/>`_.

Expand Down
Loading