|
15 | 15 | import sys |
16 | 16 |
|
17 | 17 | import lai_sphinx_theme |
18 | | -from lightning_utilities.docs import fetch_external_assets |
19 | 18 |
|
20 | 19 | import lightning |
21 | 20 |
|
|
26 | 25 | _SPHINX_MOCK_REQUIREMENTS = int(os.environ.get("SPHINX_MOCK_REQUIREMENTS", True)) |
27 | 26 | _FAST_DOCS_DEV = int(os.environ.get("FAST_DOCS_DEV", True)) |
28 | 27 | _FETCH_S3_ASSETS = int(os.getenv("DOCS_FETCH_ASSETS", not _FAST_DOCS_DEV)) |
| 28 | +_PIN_RELEASE_VERSIONS = int(os.getenv("PIN_RELEASE_VERSIONS", not _FAST_DOCS_DEV)) |
29 | 29 |
|
30 | 30 | # -- Project information ----------------------------------------------------- |
31 | 31 |
|
|
47 | 47 | # -- Project documents ------------------------------------------------------- |
48 | 48 |
|
49 | 49 | if _FETCH_S3_ASSETS: |
| 50 | + from lightning_utilities.docs import fetch_external_assets |
| 51 | + |
50 | 52 | fetch_external_assets( |
51 | 53 | docs_folder=_PATH_HERE, |
52 | 54 | assets_folder="_static/fetched-s3-assets", |
53 | 55 | retrieve_pattern=r"https?://[-a-zA-Z0-9_]+\.s3\.[-a-zA-Z0-9()_\\+.\\/=]+", |
54 | 56 | ) |
55 | 57 |
|
| 58 | +if _PIN_RELEASE_VERSIONS: |
| 59 | + from lightning_utilities.docs import adjust_linked_external_docs |
| 60 | + |
| 61 | + adjust_linked_external_docs( |
| 62 | + "https://pytorch.org/docs/stable/", "https://pytorch.org/docs/{torch.__version__}/", _PATH_ROOT |
| 63 | + ) |
| 64 | + |
56 | 65 | # -- General configuration --------------------------------------------------- |
57 | 66 |
|
58 | 67 | # If your documentation needs a minimal Sphinx version, state it here. |
|
72 | 81 | "sphinx.ext.viewcode", |
73 | 82 | "sphinx.ext.autosummary", |
74 | 83 | "sphinx.ext.napoleon", |
75 | | - "sphinx.ext.imgmath", |
76 | 84 | "sphinx.ext.autosectionlabel", |
77 | 85 | # 'sphinxcontrib.mockautodoc', # raises error: directive 'automodule' is already registered ... |
78 | 86 | # 'sphinxcontrib.fulltoc', # breaks pytorch-theme with unexpected kw argument 'titles_only' |
|
83 | 91 | "sphinx_paramlinks", |
84 | 92 | "sphinx_togglebutton", |
85 | 93 | "lai_sphinx_theme.extensions.lightning", |
| 94 | + 'sphinx.ext.mathjax', |
86 | 95 | ] |
87 | 96 |
|
88 | 97 | # Add any paths that contain templates here, relative to this directory. |
|
203 | 212 | (master_doc, project + ".tex", project + " Documentation", author, "manual"), |
204 | 213 | ] |
205 | 214 |
|
| 215 | +# MathJax configuration |
| 216 | +mathjax3_config = { |
| 217 | + 'tex': { |
| 218 | + 'packages': {'[+]': ['ams', 'newcommand', 'configMacros']} |
| 219 | + }, |
| 220 | +} |
| 221 | + |
206 | 222 | # -- Options for manual page output ------------------------------------------ |
207 | 223 |
|
208 | 224 | # One entry per manual page. List of tuples |
|
0 commit comments