diff --git a/docs/ucxx/source/conf.py b/docs/ucxx/source/conf.py index a67fc54ed..681e12256 100644 --- a/docs/ucxx/source/conf.py +++ b/docs/ucxx/source/conf.py @@ -8,6 +8,7 @@ from docutils.nodes import Node from sphinx.application import Sphinx import datetime +import os from docutils import nodes from packaging.version import Version @@ -33,6 +34,20 @@ # The full version. release = f"{UCXX_VERSION.major:02}.{UCXX_VERSION.minor:02}.{UCXX_VERSION.micro:02}" +rapids_branch_file = os.path.join( + os.path.dirname(__file__), "..", "..", "..", "RAPIDS_BRANCH" +) +try: + with open(rapids_branch_file) as f: + RAPIDS_BRANCH = f.read().strip() +except FileNotFoundError: + RAPIDS_BRANCH = "main" +nvidia_docs_intersphinx_version = ( + RAPIDS_BRANCH.removeprefix("release/") + if RAPIDS_BRANCH.startswith("release/") + else "latest" +) + # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration @@ -171,7 +186,10 @@ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - "cudf": ("https://docs.rapids.ai/api/cudf/nightly/", None), + "cudf": ( + f"https://docs.nvidia.com/cudf/{nvidia_docs_intersphinx_version}/", + None, + ), "cupy": ("https://docs.cupy.dev/en/stable/", None), "numpy": ("https://numpy.org/doc/stable", None), "pandas": ( @@ -179,7 +197,10 @@ None, ), "python": ("https://docs.python.org/3", None), - "rmm": ("https://docs.rapids.ai/api/rmm/nightly/", None), + "rmm": ( + f"https://docs.nvidia.com/rmm/{nvidia_docs_intersphinx_version}/", + None, + ), "typing_extensions": ( "https://typing-extensions.readthedocs.io/en/stable/", None,