Skip to content

Commit 2093bbb

Browse files
docs: Fix issues in readthedocs builds. (bbcmicrobit#800)
Add required .readthedocs.yml and docs/requirements.txt files. Fixes error: NameError: name 'html_theme' is not defined Also fixes a couple of issues highlighted by the sphinx build output.
1 parent dd195b5 commit 2093bbb

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

.readthedocs.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
2+
version: 2
3+
4+
build:
5+
os: ubuntu-lts-latest
6+
tools:
7+
python: "3.11"
8+
9+
sphinx:
10+
configuration: docs/conf.py
11+
12+
python:
13+
install:
14+
- requirements: docs/requirements.txt

docs/conf.py

+3-16
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
'sphinx.ext.mathjax',
3838
'sphinx.ext.ifconfig',
3939
'sphinx.ext.viewcode',
40+
'sphinx_rtd_theme',
4041
]
4142

4243
# Add any paths that contain templates here, relative to this directory.
@@ -53,7 +54,7 @@
5354

5455
# General information about the project.
5556
project = u'BBC micro:bit MicroPython'
56-
copyright = u'2015-2022, Multiple authors'
57+
copyright = u'2015-2024, Multiple authors'
5758

5859
# The version info for the project you're documenting, acts as replacement for
5960
# |version| and |release|, also used in various other places throughout the
@@ -110,7 +111,7 @@
110111

111112
# The theme to use for HTML and HTML Help pages. See the documentation for
112113
# a list of builtin themes.
113-
# html_theme = 'default'
114+
html_theme = 'sphinx_rtd_theme'
114115

115116
# Theme options are theme-specific and customize the look and feel of a theme
116117
# further. For a list of options available for each theme, see the
@@ -338,17 +339,3 @@
338339

339340
# If false, no index is generated.
340341
#epub_use_index = True
341-
342-
343-
# Example configuration for intersphinx: refer to the Python standard library.
344-
intersphinx_mapping = {'http://docs.python.org/': None}
345-
346-
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
347-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
348-
349-
if not on_rtd: # only import and set the theme if we're building docs locally
350-
import sphinx_rtd_theme
351-
html_theme = 'sphinx_rtd_theme'
352-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
353-
354-
# otherwise, readthedocs.org uses their theme by default, so no need to specify it

docs/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ Projects related to MicroPython on the BBC micro:bit include:
9393
:maxdepth: 2
9494
:caption: Developer Guide
9595

96-
devguide/installation
9796
devguide/flashfirmware
9897
devguide/repl
9998
devguide/hexformat

docs/neopixel.rst

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ art and games such as the demo shown below.
2828

2929
.. image:: neopixel.gif
3030
:alt: Neopixel flexible tile
31+
3132
Image attribution: `adafruit flexible Neopixel matrix <https://www.adafruit.com/product/2547>`_
3233

3334
To connect a strip of neopixels you'll need to attach the micro:bit as shown

docs/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx<8
2+
sphinx_rtd_theme<2

0 commit comments

Comments
 (0)