diff --git a/docs/source/conf.py b/docs/source/conf.py index 8d4b6b6db..3414fc7db 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -21,6 +21,29 @@ project = "PhotonVision" copyright = "2024, PhotonVision" author = "Banks Troutman, Matt Morley" +# -- Git configuration ----------------------------------------------------- +import subprocess + +try: + # Use closest tag + git_tag_ref = ( + subprocess.check_output( + [ + "git", + "describe", + "--tags", + ], + stderr=subprocess.DEVNULL, + ) + .strip() + .decode() + ) +except subprocess.CalledProcessError: + # Couldn't find closest tag, fallback to main + git_tag_ref = "main" + +myst_substitutions = {"git_tag_ref": git_tag_ref} + # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be @@ -158,4 +181,4 @@ if token: linkcheck_auth = [(R"https://github.com/.+", token)] # MyST configuration (https://myst-parser.readthedocs.io/en/latest/configuration.html) -myst_enable_extensions = ["colon_fence"] +myst_enable_extensions = ["colon_fence", "substitution"] diff --git a/docs/source/docs/objectDetection/opi.md b/docs/source/docs/objectDetection/opi.md index 210a9a7f2..52ae2fd91 100644 --- a/docs/source/docs/objectDetection/opi.md +++ b/docs/source/docs/objectDetection/opi.md @@ -14,6 +14,6 @@ PhotonVision currently ONLY supports 640x640 Ultralytics YOLOv5, YOLOv8, and YOL Only quantized models are supported, so take care when exporting to select the option for quantization. ::: -PhotonVision now ships with a [Python Notebook](https://github.com/PhotonVision/photonvision/blob/main/scripts/rknn-convert-tool/rknn_conversion.ipynb) that you can use in [Google Colab](https://colab.research.google.com) or in a local environment. In Google Colab, you can simply paste the PhotonVision GitHub URL into the "GitHub" tab and select the `rknn_conversion.ipynb` notebook without needing to manually download anything. +PhotonVision now ships with a {{ '[Python Notebook](https://github.com/PhotonVision/photonvision/blob/{}/scripts/rknn-convert-tool/rknn_conversion.ipynb)'.format(git_tag_ref) }} that you can use in [Google Colab](https://colab.research.google.com) or in a local environment. In Google Colab, you can simply paste the PhotonVision GitHub URL into the "GitHub" tab and select the `rknn_conversion.ipynb` notebook without needing to manually download anything. Please ensure that the model you are attempting to convert is among the {ref}`supported models ` and using the PyTorch format. diff --git a/docs/source/docs/objectDetection/rubik.md b/docs/source/docs/objectDetection/rubik.md index 6f458e876..8976cbc23 100644 --- a/docs/source/docs/objectDetection/rubik.md +++ b/docs/source/docs/objectDetection/rubik.md @@ -14,7 +14,7 @@ PhotonVision currently ONLY supports 640x640 Ultralytics YOLOv8 and YOLOv11 mode Only quantized models are supported, so take care when exporting to select the option for quantization. ::: -PhotonVision now ships with a [Python Notebook](https://github.com/PhotonVision/photonvision/blob/main/scripts/rubik_conversion.ipynb) that you can use in [Google Colab](https://colab.research.google.com) or in a local environment. In Google Colab, you can simply paste the PhotonVision GitHub URL into the "GitHub" tab and select the `rubik_conversion.ipynb` notebook without needing to manually download anything. +PhotonVision now ships with a {{ '[Python Notebook](https://github.com/PhotonVision/photonvision/blob/{}/scripts/rubik_conversion.ipynb)'.format(git_tag_ref) }} that you can use in [Google Colab](https://colab.research.google.com) or in a local environment. In Google Colab, you can simply paste the PhotonVision GitHub URL into the "GitHub" tab and select the `rubik_conversion.ipynb` notebook without needing to manually download anything. Please ensure that the model you are attempting to convert is among the {ref}`supported models ` and using the PyTorch format.