Debian Codegraph @

docs/conf.py

raw
1 # -*- coding: utf-8 -*-
2 # Licensed under a 3-clause BSD style license - see LICENSE.rst
3 #
4 # Astropy documentation build configuration file.
5 #
6 # This file is execfile()d with the current directory set to its containing dir.
7 #
8 # Note that not all possible configuration values are present in this file.
9 #
10 # All configuration values have a default. Some values are defined in
11 # the global Astropy configuration which is loaded here before anything else.
12 # See astropy.sphinx.conf for which values are set there.
13
14 # If extensions (or modules to document with autodoc) are in another directory,
15 # add these directories to sys.path here. If the directory is relative to the
16 # documentation root, use os.path.abspath to make it absolute, like shown here.
17 # sys.path.insert(0, os.path.abspath('..'))
18 # IMPORTANT: the above commented section was generated by sphinx-quickstart, but
19 # is *NOT* appropriate for astropy or Astropy affiliated packages. It is left
20 # commented out with this explanation to make it clear why this should not be
21 # done. If the sys.path entry above is added, when the astropy.sphinx.conf
22 # import occurs, it will import the *source* version of astropy instead of the
23 # version installed (if invoked as "make html" or directly with sphinx), or the
24 # version in the build directory (if "python setup.py build_sphinx" is used).
25 # Thus, any C-extensions that are needed to build the documentation will *not*
26 # be accessible, and the documentation will not build correctly.
27
28 import os
29 import sys
30 import datetime
31 from importlib import import_module
32
33 try:
34 from sphinx_astropy.conf.v1 import * # noqa
35 except ImportError:
36 print('ERROR: the documentation requires the sphinx-astropy package to be installed')
37 sys.exit(1)
38
39 # Get configuration information from setup.cfg
40 from configparser import ConfigParser
41 conf = ConfigParser()
42
43 conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')])
44 setup_cfg = dict(conf.items('metadata'))
45
46 # -- General configuration ----------------------------------------------------
47
48 # By default, highlight as Python 3.
49 highlight_language = 'python3'
50
51 # If your documentation needs a minimal Sphinx version, state it here.
52 #needs_sphinx = '1.2'
53
54 # To perform a Sphinx version check that needs to be more specific than
55 # major.minor, call `check_sphinx_version("X.Y.Z")` here.
56 # check_sphinx_version("1.2.1")
57
58 # List of patterns, relative to source directory, that match files and
59 # directories to ignore when looking for source files.
60 exclude_patterns.append('_templates')
61
62 # This is added to the end of RST files - a good place to put substitutions to
63 # be used globally.
64 rst_epilog += """
65 """
66
67 # -- Project information ------------------------------------------------------
68
69 # This does not *have* to match the package name, but typically does
70 project = setup_cfg['name']
71 author = setup_cfg['author']
72 copyright = '{0}, {1}'.format(
73 datetime.datetime.now().year, setup_cfg['author'])
74
75 # The version info for the project you're documenting, acts as replacement for
76 # |version| and |release|, also used in various other places throughout the
77 # built documents.
78
79 import_module(setup_cfg['name'])
80 package = sys.modules[setup_cfg['name']]
81
82 # The short X.Y version.
83 version = package.__version__.split('-', 1)[0]
84 # The full version, including alpha/beta/rc tags.
85 release = package.__version__
86
87
88 # -- Options for HTML output --------------------------------------------------
89
90 # A NOTE ON HTML THEMES
91 # The global astropy configuration uses a custom theme, 'bootstrap-astropy',
92 # which is installed along with astropy. A different theme can be used or
93 # the options for this theme can be modified by overriding some of the
94 # variables set in the global configuration. The variables set in the
95 # global configuration are listed below, commented out.
96
97
98 # Add any paths that contain custom themes here, relative to this directory.
99 # To use a different custom theme, add the directory containing the theme.
100 #html_theme_path = []
101
102 # The theme to use for HTML and HTML Help pages. See the documentation for
103 # a list of builtin themes. To override the custom theme, set this to the
104 # name of a builtin theme or the name of a custom theme in html_theme_path.
105 #html_theme = None
106
107
108 html_theme_options = {
109 'logotext1': 'astropy', # white, semi-bold
110 'logotext2': '-healpix', # orange, light
111 'logotext3': ':docs' # white, light
112 }
113
114
115 # Custom sidebar templates, maps document names to template names.
116 #html_sidebars = {}
117
118 # The name of an image file (relative to this directory) to place at the top
119 # of the sidebar.
120 #html_logo = ''
121
122 # The name of an image file (within the static path) to use as favicon of the
123 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
124 # pixels large.
125 #html_favicon = ''
126
127 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
128 # using the given strftime format.
129 #html_last_updated_fmt = ''
130
131 # The name for this set of Sphinx documents. If None, it defaults to
132 # "<project> v<release> documentation".
133 html_title = '{0} v{1}'.format(project, release)
134
135 # Output file base name for HTML help builder.
136 htmlhelp_basename = project + 'doc'
137
138 # Prefixes that are ignored for sorting the Python module index
139 modindex_common_prefix = ["astropy_healpix."]
140
141
142 # -- Options for LaTeX output -------------------------------------------------
143
144 # Grouping the document tree into LaTeX files. List of tuples
145 # (source start file, target name, title, author, documentclass [howto/manual]).
146 latex_documents = [('index', project + '.tex', project + u' Documentation',
147 author, 'manual')]
148
149
150 # -- Options for manual page output -------------------------------------------
151
152 # One entry per manual page. List of tuples
153 # (source start file, name, description, authors, manual section).
154 man_pages = [('index', project.lower(), project + u' Documentation',
155 [author], 1)]
156
157
158 # -- Options for the edit_on_github extension ---------------------------------
159
160 if setup_cfg.get('edit_on_github').lower() == 'true':
161
162 extensions += ['sphinx_astropy.ext.edit_on_github']
163
164 edit_on_github_project = setup_cfg['github_project']
165 edit_on_github_branch = "main"
166
167 edit_on_github_source_root = ""
168 edit_on_github_doc_root = "docs"
169
170 # -- Resolving issue number to links in changelog -----------------------------
171 github_issues_url = 'https://github.com/{0}/issues/'.format(setup_cfg['github_project'])
172
173
174 # -- Options for linkcheck output -------------------------------------------
175 linkcheck_retry = 5
176 linkcheck_ignore = [
177 r'https://github\.com/astropy/astropy/(?:issues|pull)/\d+',
178 ]
179 linkcheck_timeout = 180
180 linkcheck_anchors = False
181
182 # -- Turn on nitpicky mode for sphinx (to warn about references not found) ----
183 #
184 # nitpicky = True
185 # nitpick_ignore = []
186 #
187 # Some warnings are impossible to suppress, and you can list specific references
188 # that should be ignored in a nitpick-exceptions file which should be inside
189 # the docs/ directory. The format of the file should be:
190 #
191 # <type> <class>
192 #
193 # for example:
194 #
195 # py:class astropy.io.votable.tree.Element
196 # py:class astropy.io.votable.tree.SimpleElement
197 # py:class astropy.io.votable.tree.SimpleElementWithContent
198 #
199 # Uncomment the following lines to enable the exceptions:
200 #
201 # for line in open('nitpick-exceptions'):
202 # if line.strip() == "" or line.startswith("#"):
203 # continue
204 # dtype, target = line.split(None, 1)
205 # target = target.strip()
206 # nitpick_ignore.append((dtype, six.u(target)))