Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/11787.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update the advertised API version in the docs to `v9.20250722` and source it from `ai.backend.client.config.API_VERSION` via a Sphinx substitution so it stays in sync automatically.
28 changes: 28 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import ast
import os
import sys
from pathlib import Path
Expand Down Expand Up @@ -74,6 +75,33 @@
# The short X.Y version.
version = ".".join(release.split(".")[:2])

# Expose the current Backend.AI client API version as the |api_version|
# substitution so docs do not hard-code the string. Source of truth:
# `src/ai/backend/client/config.py` (`API_VERSION`). We parse the literal
# out of the file directly instead of importing the package, so the docs
# build does not need aiohttp / the full client runtime installed.
def _read_api_version() -> str:
config_path = root_path / "src/ai/backend/client/config.py"
source = config_path.read_text(encoding="utf-8")
for node in ast.parse(source, filename=str(config_path)).body:
if (
isinstance(node, ast.Assign)
and len(node.targets) == 1
and isinstance(node.targets[0], ast.Name)
and node.targets[0].id == "API_VERSION"
and isinstance(node.value, ast.Tuple)
and len(node.value.elts) == 2
):
major, rev = (ast.literal_eval(e) for e in node.value.elts)
return f"v{major}.{rev}"
raise RuntimeError("API_VERSION not found in src/ai/backend/client/config.py")


api_version = _read_api_version()
rst_prolog = f"""
.. |api_version| replace:: {api_version}
"""

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Backend.AI Documentation
========================

**Latest API version: v6.20220615**
**Latest API version:** |api_version|

Backend.AI is an enterprise-grade development and service backend for a wide range of AI-powered applications.
Its core technology is tailored for operating high density computing clusters including GPUs and heterogeneous accelerators.
Expand Down
2 changes: 1 addition & 1 deletion docs/install/install-from-package/install-manager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ can be configured from ``manager.toml``:
.. code-block:: console

$ curl bai-m1:8081
{"version": "v6.20220615", "manager": "22.09.6"}
{"version": "v9.20250722", "manager": "26.4.8"}

Comment thread
rapsealk marked this conversation as resolved.
Press ``Ctrl-C`` to stop the service.

Expand Down
5 changes: 2 additions & 3 deletions docs/locales/ko/LC_MESSAGES/index.po
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ msgid "Backend.AI Documentation"
msgstr "Backend.AI 레퍼런스 문서"

#: ../../index.rst:4 46ce303188ef4054a0d1690f4f5adb03
#, fuzzy
msgid "**Latest API version: v6.20220615**"
msgstr "**최근 API 버전: v5.20191215**"
msgid "**Latest API version:** |api_version|"
msgstr "**최근 API 버전:** |api_version|"

#: ../../index.rst:6 b8e94703b6e741c2bb5b33d76b5949ba
msgid ""
Expand Down
4 changes: 4 additions & 0 deletions src/ai/backend/client/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class Undefined(enum.Enum):
_config = None
_undefined = Undefined.token

# NOTE: `docs/conf.py` parses this `API_VERSION` literal with `ast` to expose
# the `|api_version|` Sphinx substitution. Keep this as a plain `Assign` of a
# 2-tuple `(int, str)` — changing the form (annotated assignment, different
# arity, etc.) requires updating `docs/conf.py:_read_api_version()`.
API_VERSION = (9, "20250722")
MIN_API_VERSION = (7, "20230615")

Expand Down
Loading