docs: pin version in links to external docs for [2/3] (#19672)

* docs: pin version in links to external docs for fabric
* ci update
This commit is contained in:
Jirka Borovec 2024-03-25 10:45:27 +01:00 committed by GitHub
parent a8190445c5
commit b9bfd1e43b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 6 deletions

View File

@ -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

View File

@ -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.

View File

@ -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
)

View File

@ -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+