diff --git a/cuda_bindings/docs/source/conf.py b/cuda_bindings/docs/source/conf.py index 93427d363..b05ff9d0d 100644 --- a/cuda_bindings/docs/source/conf.py +++ b/cuda_bindings/docs/source/conf.py @@ -9,13 +9,11 @@ # -- Path setup -------------------------------------------------------------- -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. import os +import sys +from pathlib import Path -# import sys -# sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, str((Path(__file__).parents[3] / "cuda_python" / "docs" / "exts").absolute())) # -- Project information ----------------------------------------------------- @@ -41,6 +39,7 @@ "myst_nb", "enum_tools.autoenum", "sphinx_copybutton", + "release_toc", ] nb_execution_mode = "off" diff --git a/cuda_bindings/docs/source/release.rst b/cuda_bindings/docs/source/release.rst index 7442050d3..f9a24a36b 100644 --- a/cuda_bindings/docs/source/release.rst +++ b/cuda_bindings/docs/source/release.rst @@ -6,38 +6,6 @@ Release Notes .. toctree:: :maxdepth: 3 + :glob: - 13.0.3 - 13.0.2 - 13.0.1 - 13.0.0 - 12.9.4 - 12.9.3 - 12.9.2 - 12.9.1 - 12.9.0 - 12.8.0 - 12.6.2 - 12.6.1 - 12.6.0 - 12.5.0 - 12.4.0 - 12.3.0 - 12.2.1 - 12.2.0 - 12.1.0 - 12.0.0 - 11.8.7 - 11.8.6 - 11.8.5 - 11.8.4 - 11.8.3 - 11.8.2 - 11.8.1 - 11.8.0 - 11.7.1 - 11.7.0 - 11.6.1 - 11.6.0 - 11.5.0 - 11.4.0 + release/*[0-9]-notes diff --git a/cuda_core/docs/source/conf.py b/cuda_core/docs/source/conf.py index c172d0995..e735918c4 100644 --- a/cuda_core/docs/source/conf.py +++ b/cuda_core/docs/source/conf.py @@ -9,12 +9,11 @@ # -- Path setup -------------------------------------------------------------- -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. import os +import sys +from pathlib import Path -# sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, str((Path(__file__).parents[3] / "cuda_python" / "docs" / "exts").absolute())) # -- Project information ----------------------------------------------------- @@ -41,6 +40,7 @@ "enum_tools.autoenum", "sphinx_copybutton", "sphinx_toolbox.more_autodoc.autoprotocol", + "release_toc", ] # Add any paths that contain templates here, relative to this directory. diff --git a/cuda_core/docs/source/release.rst b/cuda_core/docs/source/release.rst index 8be38864c..601f3bf22 100644 --- a/cuda_core/docs/source/release.rst +++ b/cuda_core/docs/source/release.rst @@ -6,11 +6,6 @@ Release Notes .. toctree:: :maxdepth: 3 + :glob: - 0.4.0 - 0.3.2 - 0.3.1 - 0.3.0 - 0.2.0 - 0.1.1 - 0.1.0 + release/*[0-9]-notes diff --git a/cuda_pathfinder/docs/source/conf.py b/cuda_pathfinder/docs/source/conf.py index 1ef35cc18..151e86b28 100644 --- a/cuda_pathfinder/docs/source/conf.py +++ b/cuda_pathfinder/docs/source/conf.py @@ -9,13 +9,11 @@ # -- Path setup -------------------------------------------------------------- -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. import os +import sys +from pathlib import Path -# import sys -# sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, str((Path(__file__).parents[3] / "cuda_python" / "docs" / "exts").absolute())) # -- Project information ----------------------------------------------------- @@ -41,6 +39,7 @@ "myst_nb", "enum_tools.autoenum", "sphinx_copybutton", + "release_toc", ] nb_execution_mode = "off" diff --git a/cuda_pathfinder/docs/source/release.rst b/cuda_pathfinder/docs/source/release.rst index cd837b57f..601f3bf22 100644 --- a/cuda_pathfinder/docs/source/release.rst +++ b/cuda_pathfinder/docs/source/release.rst @@ -6,12 +6,6 @@ Release Notes .. toctree:: :maxdepth: 3 + :glob: - 1.3.1 - 1.3.0 - 1.2.3 - 1.2.2 - 1.2.1 - 1.2.0 - 1.1.0 - 1.0.0 + release/*[0-9]-notes diff --git a/cuda_python/docs/exts/release_toc.py b/cuda_python/docs/exts/release_toc.py new file mode 100644 index 000000000..11abc3b11 --- /dev/null +++ b/cuda_python/docs/exts/release_toc.py @@ -0,0 +1,30 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +from pathlib import Path + +from packaging.version import Version +from sphinx.directives.other import TocTree + + +class TocTreeSorted(TocTree): + """A toctree directive that sorts entries by version.""" + + def parse_content(self, toctree): + super().parse_content(toctree) + + if not toctree["glob"]: + return + + entries = toctree.get("entries", []) + if not entries: + return + + entries = [(Version(Path(x[1]).name.removesuffix("-notes")), x[1]) for x in entries] + entries.sort(key=lambda x: x[0], reverse=True) + entries = [(str(x[0]), x[1]) for x in entries] + toctree["entries"] = entries + + +def setup(app): + app.add_directive("toctree", TocTreeSorted, override=True) diff --git a/cuda_python/docs/source/conf.py b/cuda_python/docs/source/conf.py index b8c15c6e6..8018a9110 100644 --- a/cuda_python/docs/source/conf.py +++ b/cuda_python/docs/source/conf.py @@ -9,13 +9,11 @@ # -- Path setup -------------------------------------------------------------- -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. import os +import sys +from pathlib import Path -# import sys -# sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, str((Path(__file__).parents[1] / "exts").absolute())) # -- Project information ----------------------------------------------------- @@ -38,6 +36,7 @@ "sphinx.ext.napoleon", "myst_nb", "enum_tools.autoenum", + "release_toc", ] # Add any paths that contain templates here, relative to this directory. diff --git a/cuda_python/docs/source/release.rst b/cuda_python/docs/source/release.rst index 2d8a8b1eb..f9a24a36b 100644 --- a/cuda_python/docs/source/release.rst +++ b/cuda_python/docs/source/release.rst @@ -6,18 +6,6 @@ Release Notes .. toctree:: :maxdepth: 3 + :glob: - 13.0.3 - 13.0.2 - 13.0.1 - 13.0.0 - 12.9.4 - 12.9.3 - 12.9.2 - 12.9.1 - 12.9.0 - 12.8.0 - 12.6.2 - 12.6.1 - 11.8.7 - 11.8.6 + release/*[0-9]-notes