|
1 |
| -# Configuration file for the Sphinx documentation builder. |
| 1 | + # Configuration file for the Sphinx documentation builder. |
2 | 2 | #
|
3 | 3 | # This file only contains a selection of the most common options. For a full
|
4 | 4 | # list see the documentation:
|
5 | 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html
|
6 | 6 |
|
7 |
| -import os |
8 | 7 | import sys
|
9 | 8 | from pathlib import Path
|
10 | 9 | from subprocess import check_output
|
11 |
| -from pkg_resources import require |
12 |
| - |
13 | 10 |
|
14 | 11 | import requests
|
15 | 12 |
|
16 |
| -import PandABlocks |
17 |
| - |
18 |
| -require("sphinx_rtd_theme") |
19 |
| -require("matplotlib") |
20 |
| -ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) |
21 |
| -sys.path.insert(0, ROOT) |
| 13 | +import pandablocks |
22 | 14 |
|
23 | 15 | # -- General configuration ------------------------------------------------
|
24 | 16 |
|
25 | 17 | # General information about the project.
|
26 | 18 | project = "PandABlocks.github.io"
|
27 | 19 |
|
28 | 20 | # The full version, including alpha/beta/rc tags.
|
29 |
| -release = PandABlocks.__version__ |
| 21 | +release = pandablocks.__version__ |
30 | 22 |
|
31 | 23 | # The short X.Y version.
|
32 | 24 | if "+" in release:
|
33 | 25 | # Not on a tag, use branch name
|
34 |
| - root = Path(__file__).absolute().parent.parent |
| 26 | + F = Path(__file__).absolute().parent.parent |
35 | 27 | git_branch = check_output("git branch --show-current".split(), cwd=root)
|
36 | 28 | version = git_branch.decode().strip()
|
37 | 29 | else:
|
|
52 | 44 | "sphinx_copybutton",
|
53 | 45 | # For the card element
|
54 | 46 | "sphinx_design",
|
55 |
| - # Timing plots |
56 |
| - 'matplotlib.sphinxext.plot_directive', |
57 |
| - 'common.python.sphinx_timing_directive', |
58 |
| - |
| 47 | + # So we can write markdown files |
| 48 | + "myst_parser", |
59 | 49 | ]
|
60 | 50 |
|
| 51 | +# So we can use the ::: syntax |
| 52 | +myst_enable_extensions = ["colon_fence"] |
| 53 | + |
61 | 54 | # If true, Sphinx will warn about all references where the target cannot
|
62 | 55 | # be found.
|
63 | 56 | nitpicky = True
|
|
94 | 87 | # role, that is, for text marked up `like this`
|
95 | 88 | default_role = "any"
|
96 | 89 |
|
97 |
| -# The suffix of source filenames. |
98 |
| -source_suffix = ".rst" |
99 |
| - |
100 | 90 | # The master toctree document.
|
101 | 91 | master_doc = "index"
|
102 | 92 |
|
|
110 | 100 |
|
111 | 101 | # This means you can link things like `str` and `asyncio` to the relevant
|
112 | 102 | # docs in the python documentation.
|
113 |
| -intersphinx_mapping = dict(python=("https://docs.python.org/3/", None)) |
| 103 | +intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)} |
114 | 104 |
|
115 | 105 | # A dictionary of graphviz graph attributes for inheritance diagrams.
|
116 |
| -inheritance_graph_attrs = dict(rankdir="TB") |
117 |
| - |
118 |
| -# Common links that should be available on every page |
119 |
| -rst_epilog = """ |
120 |
| -.. _Diamond Light Source: http://www.diamond.ac.uk |
121 |
| -.. _black: https://github.com/psf/black |
122 |
| -.. _flake8: https://flake8.pycqa.org/en/latest/ |
123 |
| -.. _isort: https://github.com/PyCQA/isort |
124 |
| -.. _mypy: http://mypy-lang.org/ |
125 |
| -.. _pre-commit: https://pre-commit.com/ |
126 |
| -""" |
| 106 | +inheritance_graph_attrs = {"rankdir": "TB"} |
127 | 107 |
|
128 | 108 | # Ignore localhost links for periodic check that links in docs are valid
|
129 | 109 | linkcheck_ignore = [r"http://localhost:\d+/"]
|
|
139 | 119 | # a list of builtin themes.
|
140 | 120 | #
|
141 | 121 | html_theme = "pydata_sphinx_theme"
|
142 |
| -github_repo = project |
143 |
| -github_user = "PandABlocks" |
| 122 | +github_repo = "PandABlocks.github.io" |
| 123 | +github_user = "shihab-dls" |
144 | 124 | switcher_json = f"https://{github_user}.github.io/{github_repo}/switcher.json"
|
145 | 125 | switcher_exists = requests.get(switcher_json).ok
|
146 | 126 | if not switcher_exists:
|
|
155 | 135 | # Theme options for pydata_sphinx_theme
|
156 | 136 | # We don't check switcher because there are 3 possible states for a repo:
|
157 | 137 | # 1. New project, docs are not published so there is no switcher
|
158 |
| -# 2. Existing project with latest skeleton, switcher exists and works |
159 |
| -# 3. Existing project with old skeleton that makes broken switcher, |
| 138 | +# 2. Existing project with latest copier template, switcher exists and works |
| 139 | +# 3. Existing project with old copier template that makes broken switcher, |
160 | 140 | # switcher exists but is broken
|
161 |
| -# Point 3 makes checking switcher difficult, because the updated skeleton |
| 141 | +# Point 3 makes checking switcher difficult, because the updated copier template |
162 | 142 | # will fix the switcher at the end of the docs workflow, but never gets a chance
|
163 | 143 | # to complete as the docs build warns and fails.
|
164 |
| -html_theme_options = dict( |
165 |
| - logo=dict( |
166 |
| - text=project, |
167 |
| - ), |
168 |
| - use_edit_page_button=True, |
169 |
| - github_url=f"https://github.com/{github_user}/{github_repo}", |
170 |
| - icon_links=[ |
171 |
| - dict( |
172 |
| - name="PyPI", |
173 |
| - url=f"https://pypi.org/project/{project}", |
174 |
| - icon="fas fa-cube", |
175 |
| - ) |
176 |
| - ], |
177 |
| - switcher=dict( |
178 |
| - json_url=switcher_json, |
179 |
| - version_match=version, |
180 |
| - ), |
181 |
| - check_switcher=False, |
182 |
| - navbar_end=["theme-switcher", "icon-links", "version-switcher"], |
183 |
| - external_links=[ |
184 |
| - dict( |
185 |
| - name="Release Notes", |
186 |
| - url=f"https://github.com/{github_user}/{github_repo}/releases", |
187 |
| - ) |
| 144 | +html_theme_options = { |
| 145 | + "logo": { |
| 146 | + "text": project, |
| 147 | + }, |
| 148 | + "use_edit_page_button": True, |
| 149 | + "github_url": f"https://github.com/{github_user}/{github_repo}", |
| 150 | + "icon_links": [ |
| 151 | + { |
| 152 | + "name": "PyPI", |
| 153 | + "url": f"https://pypi.org/project/{project}", |
| 154 | + "icon": "fas fa-cube", |
| 155 | + } |
188 | 156 | ],
|
189 |
| - navigation_with_keys=True, |
190 |
| -) |
| 157 | + "switcher": { |
| 158 | + "json_url": switcher_json, |
| 159 | + "version_match": version, |
| 160 | + }, |
| 161 | + "check_switcher": False, |
| 162 | + "navbar_end": ["theme-switcher", "icon-links", "version-switcher"], |
| 163 | + "navigation_with_keys": False, |
| 164 | +} |
191 | 165 |
|
192 | 166 | # A dictionary of values to pass into the template engine’s context for all pages
|
193 | 167 | html_context = {
|
194 | 168 | "github_user": github_user,
|
195 |
| - "github_repo": project, |
| 169 | + "github_repo": github_repo, |
196 | 170 | "github_version": version,
|
197 | 171 | "doc_path": "docs",
|
198 | 172 | }
|
|
204 | 178 | html_show_copyright = False
|
205 | 179 |
|
206 | 180 | # Logo
|
207 |
| -html_logo = 'images/PandA-logo-for-black-background.svg' |
208 |
| -html_favicon = "images/PandA-logo.ico" |
| 181 | +html_logo = "images/PandA-logo-for-black-background.svg" |
| 182 | +html_favicon = "images/favicon.ico" |
0 commit comments