|
2 | 2 | #
|
3 | 3 | # See LICENSE for license information.
|
4 | 4 |
|
| 5 | +import datetime |
5 | 6 | import os
|
6 |
| -import sys |
7 |
| -import sphinx_rtd_theme |
8 |
| -from sphinx.ext.autodoc.mock import mock |
9 |
| -from sphinx.ext.autodoc import between, ClassDocumenter, AttributeDocumenter |
10 |
| -from sphinx.util import inspect |
11 |
| -from builtins import str |
12 |
| -from enum import Enum |
13 |
| -import re |
| 7 | +import pathlib |
14 | 8 | import subprocess
|
15 |
| -from pathlib import Path |
16 |
| -from datetime import date |
17 |
| - |
18 |
| -te_path = os.path.dirname(os.path.realpath(__file__)) |
| 9 | +from builtins import str |
19 | 10 |
|
20 |
| -with open(te_path + "/../build_tools/VERSION.txt", "r") as f: |
21 |
| - te_version = f.readline().strip() |
| 11 | +# Basic project info |
| 12 | +project = "Transformer Engine" |
| 13 | +author = "NVIDIA CORPORATION & AFFILIATES" |
22 | 14 |
|
| 15 | +# Copyright statement |
23 | 16 | release_year = 2022
|
24 |
| - |
25 |
| -current_year = date.today().year |
| 17 | +current_year = datetime.date.today().year |
26 | 18 | if current_year == release_year:
|
27 | 19 | copyright_year = release_year
|
28 | 20 | else:
|
29 | 21 | copyright_year = str(release_year) + "-" + str(current_year)
|
| 22 | +copyright = f"{copyright_year}, NVIDIA CORPORATION & AFFILIATES. All rights reserved." |
30 | 23 |
|
31 |
| -project = "Transformer Engine" |
32 |
| -copyright = "{}, NVIDIA CORPORATION & AFFILIATES. All rights reserved.".format(copyright_year) |
33 |
| -author = "NVIDIA CORPORATION & AFFILIATES" |
| 24 | +# Transformer Engine root directory |
| 25 | +root_path = pathlib.Path(__file__).resolve().parent.parent |
34 | 26 |
|
| 27 | +# Git hash |
35 | 28 | git_sha = os.getenv("GIT_SHA")
|
36 |
| - |
37 | 29 | if not git_sha:
|
38 | 30 | try:
|
39 | 31 | git_sha = (
|
|
44 | 36 | )
|
45 | 37 | except:
|
46 | 38 | git_sha = "0000000"
|
47 |
| - |
48 | 39 | git_sha = git_sha[:7] if len(git_sha) > 7 else git_sha
|
49 | 40 |
|
50 |
| -if "dev" in te_version: |
51 |
| - version = str(te_version + "-" + git_sha) |
| 41 | +# Version |
| 42 | +with open(root_path / "build_tools" / "VERSION.txt", "r") as f: |
| 43 | + _raw_version = f.readline().strip() |
| 44 | +if "dev" in _raw_version: |
| 45 | + version = str(_raw_version + "-" + git_sha) |
52 | 46 | else:
|
53 |
| - version = str(te_version) |
54 |
| -release = te_version |
55 |
| - |
56 |
| -# hack: version is used for html creation, so put the version picker |
57 |
| -# link here as well: |
58 |
| -option_on = " selected" |
59 |
| -option_off = "" |
60 |
| -release_opt = option_on |
61 |
| -option_nr = 0 |
62 |
| -version = ( |
63 |
| - version |
64 |
| - + """<br/> |
65 |
| -Version select: <select onChange="window.location.href = this.value" onFocus="this.selectedIndex = {0}"> |
66 |
| - <option value="https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/index.html"{1}>Current release</option> |
67 |
| - <option value="https://docs.nvidia.com/deeplearning/transformer-engine/documentation-archive.html">Older releases</option> |
68 |
| -</select>""".format( |
69 |
| - option_nr, release_opt |
70 |
| - ) |
71 |
| -) |
| 47 | + version = str(_raw_version) |
| 48 | +release = _raw_version |
72 | 49 |
|
73 | 50 | # -- General configuration ---------------------------------------------------
|
74 | 51 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
92 | 69 |
|
93 | 70 | pygments_style = "sphinx"
|
94 | 71 |
|
95 |
| - |
96 | 72 | # -- Options for HTML output -------------------------------------------------
|
97 | 73 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
98 | 74 |
|
99 | 75 | html_theme = "sphinx_rtd_theme"
|
100 |
| -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] |
101 | 76 | html_static_path = ["_static"]
|
102 | 77 | html_show_sphinx = False
|
103 | 78 |
|
|
106 | 81 | "css/nvidia_footer.css",
|
107 | 82 | ]
|
108 | 83 |
|
109 |
| -html_theme_options = {"display_version": True, "collapse_navigation": False, "logo_only": False} |
| 84 | +html_theme_options = { |
| 85 | + "collapse_navigation": False, |
| 86 | + "logo_only": False, |
| 87 | + "version_selector": False, |
| 88 | + "language_selector": False, |
| 89 | +} |
110 | 90 |
|
111 | 91 | napoleon_custom_sections = [
|
112 | 92 | ("Parallelism parameters", "params_style"),
|
|
116 | 96 | ("FP8-related parameters", "params_style"),
|
117 | 97 | ]
|
118 | 98 |
|
119 |
| -breathe_projects = {"TransformerEngine": os.path.abspath("doxygen/xml/")} |
| 99 | +breathe_projects = {"TransformerEngine": root_path / "docs" / "doxygen" / "xml"} |
120 | 100 | breathe_default_project = "TransformerEngine"
|
121 | 101 |
|
122 | 102 | autoapi_generate_api_docs = False
|
123 |
| -autoapi_dirs = ["../transformer_engine"] |
| 103 | +autoapi_dirs = [root_path / "transformer_engine"] |
0 commit comments