Skip to content

Commit 8ba784c

Browse files
Derive main branch version from highest release cycle entry
1 parent 7fa9184 commit 8ba784c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

conf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,13 @@
188188
"""
189189

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

0 commit comments

Comments
 (0)