conf.py 3.02 KB
Newer Older
1
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Przemek Tredak's avatar
Przemek Tredak committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
# See LICENSE for license information.

import os
import sys
import sphinx_rtd_theme
from sphinx.ext.autodoc.mock import mock
from sphinx.ext.autodoc import between, ClassDocumenter, AttributeDocumenter
from sphinx.util import inspect
from builtins import str
from enum import Enum
import re
import subprocess
from pathlib import Path
from datetime import date

te_path = os.path.dirname(os.path.realpath(__file__))

with open(te_path + "/../VERSION", "r") as f:
    te_version = f.readline()

release_year = 2022

current_year = date.today().year
if current_year == release_year:
    copyright_year = release_year
else:
    copyright_year = str(release_year) + "-" + str(current_year)

project = u'Transformer Engine'
copyright = u'{}, NVIDIA CORPORATION & AFFILIATES. All rights reserved.'.format(copyright_year)
author = u'NVIDIA CORPORATION & AFFILIATES'
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

git_sha = os.getenv("GIT_SHA")

if not git_sha:
    try:
        git_sha = subprocess.check_output(["git", "log", "--pretty=format:'%h'", "-n1"]).decode('ascii').replace("'","").strip()
    except:
        git_sha = u'0000000'

git_sha = git_sha[:7] if len(git_sha) > 7 else git_sha

version = str(te_version + u"-" + git_sha)
release = te_version

# hack: version is used for html creation, so put the version picker
# link here as well:
option_on = " selected"
option_off = ""
release_opt = option_on
option_nr = 0
version = version + """<br/>
Version select: <select onChange="window.location.href = this.value" onFocus="this.selectedIndex = {0}">
    <option value="https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/index.html"{1}>Current release</option>
    <option value="https://docs.nvidia.com/deeplearning/transformer-engine/archives/index.html">Older releases</option>
</select>""".format(option_nr, release_opt)
Przemek Tredak's avatar
Przemek Tredak committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
        'sphinx.ext.autodoc',
        'sphinx.ext.mathjax',
        'sphinx.ext.napoleon',
        'nbsphinx',
        'breathe']

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

source_suffix = '.rst'

master_doc = 'index'

pygments_style = 'sphinx'



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
86
html_static_path = []
Przemek Tredak's avatar
Przemek Tredak committed
87
88
89
90
91
92
93
94
95
96
97
98
99

html_theme_options = {
        'display_version': True,
        'collapse_navigation': False,
        'logo_only': False
}

napoleon_custom_sections = [('Parallelism parameters', 'params_style'),
                            ('Optimization parameters', 'params_style'),
                            ('Values', 'params_style')]

breathe_projects = {"TransformerEngine": os.path.abspath("doxygen/xml/")}
breathe_default_project = "TransformerEngine"