Skip to content

Commit 24b796a

Browse files
author
Shihab Suliman
committed
Edited conf.py
1 parent e1f1f9f commit 24b796a

File tree

1 file changed

+39
-65
lines changed

1 file changed

+39
-65
lines changed

docs/conf.py

Lines changed: 39 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,29 @@
1-
# Configuration file for the Sphinx documentation builder.
1+
# Configuration file for the Sphinx documentation builder.
22
#
33
# This file only contains a selection of the most common options. For a full
44
# list see the documentation:
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

7-
import os
87
import sys
98
from pathlib import Path
109
from subprocess import check_output
11-
from pkg_resources import require
12-
1310

1411
import requests
1512

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
2214

2315
# -- General configuration ------------------------------------------------
2416

2517
# General information about the project.
2618
project = "PandABlocks.github.io"
2719

2820
# The full version, including alpha/beta/rc tags.
29-
release = PandABlocks.__version__
21+
release = pandablocks.__version__
3022

3123
# The short X.Y version.
3224
if "+" in release:
3325
# Not on a tag, use branch name
34-
root = Path(__file__).absolute().parent.parent
26+
F = Path(__file__).absolute().parent.parent
3527
git_branch = check_output("git branch --show-current".split(), cwd=root)
3628
version = git_branch.decode().strip()
3729
else:
@@ -52,12 +44,13 @@
5244
"sphinx_copybutton",
5345
# For the card element
5446
"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",
5949
]
6050

51+
# So we can use the ::: syntax
52+
myst_enable_extensions = ["colon_fence"]
53+
6154
# If true, Sphinx will warn about all references where the target cannot
6255
# be found.
6356
nitpicky = True
@@ -94,9 +87,6 @@
9487
# role, that is, for text marked up `like this`
9588
default_role = "any"
9689

97-
# The suffix of source filenames.
98-
source_suffix = ".rst"
99-
10090
# The master toctree document.
10191
master_doc = "index"
10292

@@ -110,20 +100,10 @@
110100

111101
# This means you can link things like `str` and `asyncio` to the relevant
112102
# 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)}
114104

115105
# 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"}
127107

128108
# Ignore localhost links for periodic check that links in docs are valid
129109
linkcheck_ignore = [r"http://localhost:\d+/"]
@@ -139,8 +119,8 @@
139119
# a list of builtin themes.
140120
#
141121
html_theme = "pydata_sphinx_theme"
142-
github_repo = project
143-
github_user = "PandABlocks"
122+
github_repo = "PandABlocks.github.io"
123+
github_user = "shihab-dls"
144124
switcher_json = f"https://{github_user}.github.io/{github_repo}/switcher.json"
145125
switcher_exists = requests.get(switcher_json).ok
146126
if not switcher_exists:
@@ -155,44 +135,38 @@
155135
# Theme options for pydata_sphinx_theme
156136
# We don't check switcher because there are 3 possible states for a repo:
157137
# 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,
160140
# 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
162142
# will fix the switcher at the end of the docs workflow, but never gets a chance
163143
# 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+
}
188156
],
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+
}
191165

192166
# A dictionary of values to pass into the template engine’s context for all pages
193167
html_context = {
194168
"github_user": github_user,
195-
"github_repo": project,
169+
"github_repo": github_repo,
196170
"github_version": version,
197171
"doc_path": "docs",
198172
}
@@ -204,5 +178,5 @@
204178
html_show_copyright = False
205179

206180
# 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

Comments
 (0)