Debian Codegraph @

docs/conf.py

raw ◀ ▶
4 Debian patches touch this file
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 from configparser import ConfigParser
15 import sys
16 import datetime
17
18 try:
19 from sphinx_astropy.conf.v2 import * # noqa
20 except ImportError:
21 print('ERROR: the documentation requires the sphinx-astropy package to '
22 'be installed')
23 sys.exit(1)
24
25 # Get configuration information from setup.cfg
26 conf = ConfigParser()
27 conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')])
28 setup_cfg = dict(conf.items('metadata'))
29
30
31 # -- General configuration ----------------------------------------------------
32 # By default, highlight as Python 3.
33 highlight_language = 'python3'
34
35 # If your documentation needs a minimal Sphinx version, state it here.
36 # needs_sphinx = '1.7'
37
38 # Extend astropy intersphinx_mapping with packages we use here
39 intersphinx_mapping['astroquery'] = ('http://astroquery.readthedocs.io/en/latest/', None)
40
41 # Exclude astropy intersphinx_mapping for unused packages
•42 #del intersphinx_mapping['h5py'] # noqa
43
44 # List of patterns, relative to source directory, that match files and
45 # directories to ignore when looking for source files.
46 exclude_patterns.append('_templates') # noqa
47 # Exclude template PSF block specification documentation
48 exclude_patterns.append('psf_spec/*') # noqa
49
50 plot_formats = ['png', 'hires.png', 'pdf', 'svg']
•51 plot_rcparams = {
52 'svg.hashsalt': 'https://reproducible-builds.org',
53 }
54
55 # This is added to the end of RST files - a good place to put
56 # substitutions to be used globally.
57 rst_epilog = """
58 .. _Astropy: https://www.astropy.org/
59 """
60
61 # -- Project information ------------------------------------------------------
62
63 # This does not *have* to match the package name, but typically does
64 project = setup_cfg['name']
65 author = setup_cfg['author']
66 copyright = '{0}, {1}'.format(
67 datetime.datetime.now().year, setup_cfg['author'])
68
69 # The version info for the project you're documenting, acts as replacement for
70 # |version| and |release|, also used in various other places throughout the
71 # built documents.
72 __import__(project)
73 package = sys.modules[project]
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 # The full version, including alpha/beta/rc tags.
•80 release = package.__version__
81 # The short X.Y version.
82 version = ".".join(release.split(".")[:2])
83
84 # Only include dev docs in dev version.
85 dev = "dev" in release
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 # Add any paths that contain custom themes here, relative to this directory.
98 # To use a different custom theme, add the directory containing the theme.
99 #html_theme_path = []
100
101 # The theme to use for HTML and HTML Help pages. See the documentation for
102 # a list of builtin themes. To override the custom theme, set this to the
103 # name of a builtin theme or the name of a custom theme in html_theme_path.
104 # html_theme = None
105
106 # Custom sidebar templates, maps document names to template names.
107 #html_sidebars = {}
108
109 # The name of an image file (within the static path) to use as favicon of the
110 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
111 # pixels large.
112 #html_favicon = ''
113
114 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
115 # using the given strftime format.
116 #html_last_updated_fmt = ''
117
118 # The name for this set of Sphinx documents. If None, it defaults to
119 # "<project> v<release> documentation".
120 html_title = '{0} v{1}'.format(project, release)
121
122 # Output file base name for HTML help builder.
123 htmlhelp_basename = project + 'doc'
124
125 # Prefixes that are ignored for sorting the Python module index
126 modindex_common_prefix = ["astroplan."]
127
128 # -- Options for LaTeX output --------------------------------------------------
129
130 # Grouping the document tree into LaTeX files. List of tuples
131 # (source start file, target name, title, author, documentclass [howto/manual]).
132 latex_documents = [('index', project + '.tex', project + u' Documentation',
133 author, 'manual')]
134
135
136 # -- Options for manual page output --------------------------------------------
137
138 # One entry per manual page. List of tuples
139 # (source start file, name, description, authors, manual section).
140 man_pages = [('index', project.lower(), project + u' Documentation',
141 [author], 1)]
142
143
144 # -- Options for the edit_on_github extension ----------------------------------
145
146 if setup_cfg.get('edit_on_github').lower() == 'true':
147
148 extensions += ['sphinx_astropy.ext.edit_on_github']
149
150 edit_on_github_project = setup_cfg['github_project']
151 edit_on_github_branch = "main"
152
153 edit_on_github_source_root = ""
154 edit_on_github_doc_root = "docs"
155
156 # Make appropriate substitutions to mock internet querying methods
157 # within the tests.
158 # Currently this is not needed because of the content of the tests, but we leave
159 # it here in case it's needed again in the future. BUT beware of:
160 # https://github.com/astropy/astroplan/issues/96
161 #from astroplan.utils import _mock_remote_data
162 #_mock_remote_data()
163
164 # Add additional Sphinx extensions:
165 extensions += [
166 'matplotlib.sphinxext.plot_directive',
167 'sphinx.ext.graphviz'
168 ]
169
170 # -- Resolving issue number to links in changelog -----------------------------
171 github_issues_url = 'https://github.com/{0}/issues/'.format(setup_cfg['github_p\
172 roject'])
173
174 # -- Options for linkcheck output -------------------------------------------
175 linkcheck_retry = 5
176 linkcheck_ignore = [
177 r'https://github\.com/astropy/astroplan/(?: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 nitpicky = True
184
185 html_copy_source = False
186
187 html_theme_options.update( # noqa: F405
188 {
189 "github_url": "https://github.com/astropy/astroplan",
190 "external_links": [
191 {"name": "astropy docs", "url": "https://docs.astropy.org/en/stable/"},
192 ],
193 "use_edit_page_button": True,
194 }
195 )
196
197 html_context = {
198 "default_mode": "light",
199 "to_be_indexed": ["stable", "latest"],
200 "is_development": dev,
201 "github_user": "astropy",
202 "github_repo": "astroplan",
203 "github_version": "main",
204 "doc_path": "docs",
205 }
206
207 # Add any extra paths that contain custom files (such as robots.txt or
208 # .htaccess) here, relative to this directory. These files are copied
209 # directly to the root of the documentation.
210 html_extra_path = ["robots.txt"]
211
212 #
213 # Some warnings are impossible to suppress, and you can list specific references
214 # that should be ignored in a nitpick-exceptions file which should be inside
215 # the docs/ directory. The format of the file should be:
216 #
217 # <type> <class>
218 #
219 # for example:
220 #
221 # py:class astropy.io.votable.tree.Element
222 # py:class astropy.io.votable.tree.SimpleElement
223 # py:class astropy.io.votable.tree.SimpleElementWithContent
224 #
225 # Uncomment the following lines to enable the exceptions:
226 #
227 # for line in open('nitpick-exceptions'):
228 # if line.strip() == "" or line.startswith("#"):
229 # continue
230 # dtype, target = line.split(None, 1)
231 # target = target.strip()
232 # nitpick_ignore.append((dtype, six.u(target)))
•233
234 autodoc_preserve_defaults = True # http://bugs.debian.org/1064858