Skip to content

Commit

Permalink
docs: pin version in links to external docs for [2/3] (#19672)
Browse files Browse the repository at this point in the history
* docs: pin version in links to external docs for fabric
* ci update
  • Loading branch information
Borda committed Mar 25, 2024
1 parent a819044 commit b9bfd1e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion docs/source-fabric/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import sys

import lai_sphinx_theme
from lightning_utilities.docs import fetch_external_assets

import lightning

Expand All @@ -26,6 +25,7 @@
_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 -----------------------------------------------------

Expand All @@ -47,12 +47,21 @@
# -- 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.
Expand Down
6 changes: 4 additions & 2 deletions docs/source-pytorch/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
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
Expand Down Expand Up @@ -104,14 +103,17 @@ def _load_py_module(name: str, location: str) -> ModuleType:
)

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
)
Expand Down
3 changes: 3 additions & 0 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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+

0 comments on commit b9bfd1e

Please sign in to comment.