Skip to content

Dynamically substitute main version in versions.rst from release-cycle.json #1583

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

Prev Previous commit
Next Next commit
Define mainversion substitution as part of rst_prolog
  • Loading branch information
corneliusroemer committed Jun 19, 2025
commit 3064c16c689c77e4acad4aa4bf989edbe461b9f5
25 changes: 13 additions & 12 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,18 @@
# sphinx-notfound-page
notfound_urls_prefix = "/"

# Dynamically expose the Python version associated with the "main" branch.
# The release cycle data may not be ordered, so choose the numerically highest
# version key instead of relying on a specific entry's position.
with open("include/release-cycle.json", encoding="UTF-8") as _f:
_cycle = json.load(_f)
_main_version = max(
_cycle,
key=lambda v: tuple(int(part) for part in v.split(".")),
)

# 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 @@ -185,18 +195,9 @@

.. _Refactoring the DevGuide: https://discuss.python.org/t/refactoring-the-devguide-into-a-contribution-guide/63409

"""
.. |mainversion| replace:: {_main_version}

# Dynamically expose the Python version associated with the "main" branch.
# The release cycle data may not be ordered, so choose the numerically highest
# version key instead of relying on a specific entry's position.
with open("include/release-cycle.json", encoding="UTF-8") as _f:
_cycle = json.load(_f)
_main_version = max(
_cycle,
key=lambda v: tuple(int(part) for part in v.split(".")),
)
rst_prolog += f"\n.. |mainversion| replace:: {_main_version}\n"
"""

# sphinx.ext.extlinks
# This config is a dictionary of external sites,
Expand Down
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