From b9bfd1e43b83998ea8601a252a93eda52f05a615 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Mon, 25 Mar 2024 10:45:27 +0100 Subject: [PATCH] docs: pin version in links to external docs for [2/3] (#19672) * docs: pin version in links to external docs for fabric * ci update --- .github/workflows/docs-build.yml | 5 ++--- docs/source-fabric/conf.py | 11 ++++++++++- docs/source-pytorch/conf.py | 6 ++++-- requirements/docs.txt | 3 +++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml index f2cdb16529..64510b45c0 100644 --- a/.github/workflows/docs-build.yml +++ b/.github/workflows/docs-build.yml @@ -62,6 +62,7 @@ jobs: target: ["html", "doctest", "linkcheck"] env: DOCS_COPY_NOTEBOOKS: 1 + PIN_RELEASE_VERSIONS: 1 ARTIFACT_DAYS: 0 steps: - uses: actions/checkout@v4 @@ -106,9 +107,7 @@ jobs: - name: Full build for deployment if: github.event_name != 'pull_request' - run: | - echo "DOCS_FETCH_ASSETS=1" >> $GITHUB_ENV - echo "PIN_RELEASE_VERSIONS=1" >> $GITHUB_ENV + run: echo "DOCS_FETCH_ASSETS=1" >> $GITHUB_ENV - name: Make ${{ matrix.target }} working-directory: ./docs/source-${{ matrix.pkg-name }} # allow failing link check and doctest if you run with dispatch diff --git a/docs/source-fabric/conf.py b/docs/source-fabric/conf.py index 60d4907d50..2428ed46ec 100644 --- a/docs/source-fabric/conf.py +++ b/docs/source-fabric/conf.py @@ -15,7 +15,6 @@ import os import sys import lai_sphinx_theme -from lightning_utilities.docs import fetch_external_assets import lightning @@ -26,6 +25,7 @@ sys.path.insert(0, os.path.abspath(_PATH_ROOT)) _SPHINX_MOCK_REQUIREMENTS = int(os.environ.get("SPHINX_MOCK_REQUIREMENTS", True)) _FAST_DOCS_DEV = int(os.environ.get("FAST_DOCS_DEV", True)) _FETCH_S3_ASSETS = int(os.getenv("DOCS_FETCH_ASSETS", not _FAST_DOCS_DEV)) +_PIN_RELEASE_VERSIONS = int(os.getenv("PIN_RELEASE_VERSIONS", not _FAST_DOCS_DEV)) # -- Project information ----------------------------------------------------- @@ -47,12 +47,21 @@ github_repo = project # -- Project documents ------------------------------------------------------- if _FETCH_S3_ASSETS: + from lightning_utilities.docs import fetch_external_assets + fetch_external_assets( docs_folder=_PATH_HERE, assets_folder="_static/fetched-s3-assets", retrieve_pattern=r"https?://[-a-zA-Z0-9_]+\.s3\.[-a-zA-Z0-9()_\\+.\\/=]+", ) +if _PIN_RELEASE_VERSIONS: + from lightning_utilities.docs import adjust_linked_external_docs + + adjust_linked_external_docs( + "https://pytorch.org/docs/stable/", "https://pytorch.org/docs/{torch.__version__}/", _PATH_ROOT + ) + # -- General configuration --------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. diff --git a/docs/source-pytorch/conf.py b/docs/source-pytorch/conf.py index 4329110d80..9be0c5764a 100644 --- a/docs/source-pytorch/conf.py +++ b/docs/source-pytorch/conf.py @@ -19,7 +19,6 @@ from importlib.util import module_from_spec, spec_from_file_location from types import ModuleType import lai_sphinx_theme -from lightning_utilities.docs import adjust_linked_external_docs, fetch_external_assets from lightning_utilities.docs.formatting import _transform_changelog import lightning @@ -104,14 +103,17 @@ assist_local.AssistantCLI.pull_docs_files( ) if _FETCH_S3_ASSETS: + from lightning_utilities.docs import fetch_external_assets + fetch_external_assets( docs_folder=_PATH_HERE, assets_folder="_static/fetched-s3-assets", retrieve_pattern=r"https?://[-a-zA-Z0-9_]+\.s3\.[-a-zA-Z0-9()_\\+.\\/=]+", ) - if _PIN_RELEASE_VERSIONS: + from lightning_utilities.docs import adjust_linked_external_docs + adjust_linked_external_docs( "https://numpy.org/doc/stable/", "https://numpy.org/doc/{numpy.__version__}/", _PATH_ROOT ) diff --git a/requirements/docs.txt b/requirements/docs.txt index 0689c439bf..fe5b9c1d99 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -21,3 +21,6 @@ lightning-utilities >=0.11.0, <0.12.0 # installed from S3 location and fetched in advance lai-sphinx-theme + +# needed for replacing stable keyword with latest version linkd +tensorboard # todo: remove this when updating Utils to 0.11.1+