Debian Codegraph @

docs/conf.py

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