|
27 | 27 |
|
28 | 28 | import sys |
29 | 29 | import datetime |
30 | | - |
31 | 30 | import sphinx |
32 | 31 |
|
33 | 32 | from specreduce import __version__ |
34 | 33 |
|
35 | 34 | try: |
36 | | - from sphinx_astropy.conf.v1 import * # noqa |
| 35 | + from sphinx_astropy.conf.v2 import * # noqa |
| 36 | + from sphinx_astropy.conf.v2 import extensions # noqa |
37 | 37 | except ImportError: |
38 | | - print('ERROR: the documentation requires the sphinx-astropy package to be installed') |
| 38 | + print("ERROR: the documentation requires the sphinx-astropy package to be installed") |
39 | 39 | sys.exit(1) |
40 | 40 |
|
41 | 41 | # xref: https://github.com/sphinx-doc/sphinx/issues/13232#issuecomment-2608708175 |
42 | 42 | if sys.version_info[:2] >= (3, 13) and sphinx.version_info[:2] < (8, 2): |
43 | 43 | import pathlib |
44 | | - |
45 | 44 | from sphinx.util.typing import _INVALID_BUILTIN_CLASSES |
46 | 45 |
|
47 | 46 | _INVALID_BUILTIN_CLASSES[pathlib.Path] = "pathlib.Path" |
48 | 47 |
|
49 | 48 | # -- General configuration ---------------------------------------------------- |
50 | 49 |
|
51 | 50 | # By default, highlight as Python 3. |
52 | | -highlight_language = 'python3' |
| 51 | +highlight_language = "python3" |
53 | 52 |
|
54 | 53 | # If your documentation needs a minimal Sphinx version, state it here. |
55 | | -#needs_sphinx = '1.2' |
| 54 | +needs_sphinx = "3.0" |
56 | 55 |
|
57 | 56 | # To perform a Sphinx version check that needs to be more specific than |
58 | 57 | # major.minor, call `check_sphinx_version("x.y.z")` here. |
59 | 58 | # check_sphinx_version("1.2.1") |
60 | 59 |
|
61 | 60 | # List of patterns, relative to source directory, that match files and |
62 | 61 | # directories to ignore when looking for source files. |
63 | | -exclude_patterns.append('_templates') |
| 62 | +exclude_patterns.append("_templates") |
64 | 63 |
|
65 | 64 | # This is added to the end of RST files - a good place to put substitutions to |
66 | 65 | # be used globally. |
67 | | -rst_epilog += """ |
68 | | -""" |
| 66 | +#rst_epilog += """ |
| 67 | +#.. _Astropy: https://www.astropy.org/ |
| 68 | +#""" |
| 69 | + |
| 70 | +extensions.extend( |
| 71 | + [ |
| 72 | + "sphinx_design", |
| 73 | + "nbsphinx", |
| 74 | + ] |
| 75 | +) |
69 | 76 |
|
70 | 77 | # -- Project information ------------------------------------------------------ |
71 | 78 |
|
72 | 79 | # This does not *have* to match the package name, but typically does |
73 | 80 | project = "specreduce" |
74 | 81 | author = "Astropy Specreduce contributors" |
75 | | -copyright = '{0}, {1}'.format( |
76 | | - datetime.datetime.now().year, author) |
| 82 | +copyright = "{0}, {1}".format(datetime.datetime.now().year, author) |
77 | 83 |
|
78 | 84 | # The version info for the project you're documenting, acts as replacement for |
79 | 85 | # |version| and |release|, also used in various other places throughout the |
80 | 86 | # built documents. |
81 | 87 |
|
82 | 88 | # The short X.Y version. |
83 | | -version = __version__.split('-', 1)[0] |
| 89 | +version = __version__.split("-", 1)[0] |
84 | 90 | # The full version, including alpha/beta/rc tags. |
85 | 91 | release = __version__ |
86 | 92 |
|
87 | 93 |
|
88 | 94 | # -- Options for HTML output -------------------------------------------------- |
89 | 95 |
|
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 | | -html_static_path = ['_static'] # html_theme = None |
107 | | -html_style = 'specreduce.css' |
| 96 | +html_static_path = ["_static"] # html_theme = None |
| 97 | +html_style = "specreduce.css" |
108 | 98 |
|
109 | | - |
110 | | -html_theme_options = { |
111 | | - 'logotext1': 'spec', # white, semi-bold |
112 | | - 'logotext2': 'reduce', # orange, light |
113 | | - 'logotext3': ':docs' # white, light |
| 99 | +html_theme_options.update( |
| 100 | + { |
| 101 | + "github_url": "https://github.com/astropy/specreduce", |
| 102 | + "use_edit_page_button": False, |
| 103 | + "navigation_with_keys": False, |
| 104 | + "logo": { |
| 105 | + "text": f"{project}", |
| 106 | + "image_light": "_static/logo_icon.png", |
| 107 | + "image_dark": "_static/logo_icon.png", |
| 108 | + }, |
| 109 | + "secondary_sidebar_items": {"**": ["page-toc"], "index": []}, |
114 | 110 | } |
| 111 | +) |
| 112 | + |
| 113 | +html_context = { |
| 114 | + "default_mode": "light", |
| 115 | + "version_slug": os.environ.get("READTHEDOCS_VERSION") or "", |
| 116 | + "to_be_indexed": ["stable", "latest"], |
| 117 | + "github_user": "astropy", |
| 118 | + "github_repo": "specreduce", |
| 119 | + "github_version": "main", |
| 120 | + "doc_path": "docs", |
| 121 | + "edit_page_url_template": "{{ astropy_custom_edit_url(github_user, github_repo, github_version, doc_path, file_name, default_edit_page_url_template) }}", |
| 122 | + "default_edit_page_url_template": "https://github.com/{github_user}/{github_repo}/edit/{github_version}/{doc_path}{file_name}", |
| 123 | + # Tell Jinja2 templates the build is running on Read the Docs |
| 124 | + "READTHEDOCS": os.environ.get("READTHEDOCS", "") == "True", |
| 125 | +} |
115 | 126 |
|
116 | 127 | # Custom sidebar templates, maps document names to template names. |
117 | | -#html_sidebars = {} |
118 | | -html_sidebars['**'] = ['localtoc.html'] |
119 | | -html_sidebars['index'] = ['globaltoc.html', 'localtoc.html'] |
| 128 | +html_sidebars = {} |
| 129 | +html_sidebars['index'] = [] |
| 130 | +html_sidebars["contributing"] = [] |
120 | 131 |
|
121 | | -# The name of an image file (relative to this directory) to place at the top |
122 | | -# of the sidebar. |
123 | | -#html_logo = '' |
| 132 | +# html_sidebars['**'] = ['localtoc.html'] |
| 133 | +# html_sidebars['index'] = [] #['globaltoc.html', 'localtoc.html'] |
124 | 134 |
|
125 | 135 | # The name of an image file (within the static path) to use as favicon of the |
126 | 136 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 |
127 | 137 | # pixels large. |
128 | | -html_favicon = '_static/logo_icon.ico' |
| 138 | +html_favicon = "_static/logo_icon.ico" |
129 | 139 |
|
130 | 140 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
131 | 141 | # using the given strftime format. |
132 | | -#html_last_updated_fmt = '' |
| 142 | +# html_last_updated_fmt = '' |
133 | 143 |
|
134 | 144 | # The name for this set of Sphinx documents. If None, it defaults to |
135 | 145 | # "<project> v<release> documentation". |
136 | | -html_title = '{0} v{1}'.format(project, release) |
| 146 | +html_title = "{0} v{1}".format(project, release) |
137 | 147 |
|
138 | 148 | # Output file base name for HTML help builder. |
139 | | -htmlhelp_basename = project + 'doc' |
| 149 | +htmlhelp_basename = project + "doc" |
140 | 150 |
|
141 | 151 | # Prefixes that are ignored for sorting the Python module index |
142 | 152 | modindex_common_prefix = ["specreduce."] |
|
145 | 155 |
|
146 | 156 | # Grouping the document tree into LaTeX files. List of tuples |
147 | 157 | # (source start file, target name, title, author, documentclass [howto/manual]). |
148 | | -latex_documents = [('index', project + '.tex', project + u' Documentation', |
149 | | - author, 'manual')] |
| 158 | +latex_documents = [("index", project + ".tex", project + " Documentation", author, "manual")] |
150 | 159 |
|
151 | 160 |
|
152 | 161 | # -- Options for manual page output ------------------------------------------- |
153 | 162 |
|
154 | 163 | # One entry per manual page. List of tuples |
155 | 164 | # (source start file, name, description, authors, manual section). |
156 | | -man_pages = [('index', project.lower(), project + u' Documentation', |
157 | | - [author], 1)] |
| 165 | +man_pages = [("index", project.lower(), project + " Documentation", [author], 1)] |
| 166 | + |
| 167 | +# -- Options for numpydoc extension ------------------------------------------- |
| 168 | +numpydoc_xref_param_type = False |
158 | 169 |
|
159 | | -extensions.append('nbsphinx') |
160 | 170 |
|
161 | 171 | # -- Options for the edit_on_github extension --------------------------------- |
162 | 172 |
|
|
165 | 175 | nitpicky = True |
166 | 176 | intersphinx_mapping.update( |
167 | 177 | { |
168 | | - 'astropy': ('https://docs.astropy.org/en/stable/', None), |
169 | | - 'ccdproc': ('https://ccdproc.readthedocs.io/en/stable/', None), |
170 | | - 'specutils': ('https://specutils.readthedocs.io/en/stable/', None), |
171 | | - 'gwcs': ('https://gwcs.readthedocs.io/en/stable/', None) |
| 178 | + "astropy": ("https://docs.astropy.org/en/stable/", None), |
| 179 | + "ccdproc": ("https://ccdproc.readthedocs.io/en/stable/", None), |
| 180 | + "specutils": ("https://specutils.readthedocs.io/en/stable/", None), |
| 181 | + "gwcs": ("https://gwcs.readthedocs.io/en/stable/", None), |
172 | 182 | } |
173 | 183 | ) |
174 | 184 | # |
|
0 commit comments