Skip to content

Commit 1b453ed

Browse files
authored
Merge pull request #2745 from freakboy3742/rtd-py-version
Add explicit RTD version pin, and protect against Sphinx 8 deprecations
2 parents afef6ab + 0c3a438 commit 1b453ed

File tree

5 files changed

+21
-25
lines changed

5 files changed

+21
-25
lines changed

.readthedocs.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ version: 2
77
build:
88
os: ubuntu-22.04
99
tools:
10-
# On Python 3.12, pip fails with AttributeError: module 'pkgutil' has no attribute
11-
# 'ImpImporter', probably because readthedocs provides an old version of pip.
12-
python: "3.11"
10+
# Docs are always built on Python 3.12. See also the tox config and contribution docs.
11+
python: "3.12"
1312
jobs:
1413
post_checkout:
1514
# RTD defaults to a depth of 50 but Toga versioning may require

changes/2745.doc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Building Toga's documentation now requires the use of Python 3.12.

core/pyproject.toml

+4-6
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,15 @@ dev = [
8080
# typing-extensions needed for TypeAlias added in Py 3.10
8181
"typing-extensions == 4.9.0 ; python_version < '3.10'",
8282
]
83+
# Docs are always built on a specific Python version; see RTD and tox config files,
84+
# and the docs contribution guide.
8385
docs = [
8486
"furo == 2024.7.18",
8587
"Pillow == 10.4.0",
8688
"pyenchant == 3.2.2",
87-
# Sphinx 7.2 deprecated support for Python 3.8
88-
"sphinx == 7.1.2 ; python_version < '3.9'",
89-
"sphinx == 7.3.7 ; python_version >= '3.9'",
89+
"sphinx == 7.3.7",
9090
"sphinx_tabs == 3.4.5",
91-
# Sphinx 2024.2.4 deprecated support for Python 3.8
92-
"sphinx-autobuild == 2021.3.14 ; python_version < '3.9'",
93-
"sphinx-autobuild == 2024.4.16 ; python_version >= '3.9'",
91+
"sphinx-autobuild == 2024.4.16",
9492
"sphinx-csv-filter == 0.4.1",
9593
"sphinx-copybutton == 0.5.2",
9694
"sphinx-toolbox == 3.7.0",

docs/how-to/contribute/docs.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ documentation.
1414
Building Toga's documentation
1515
=============================
1616

17-
To build Toga's documentation, start by :ref:`setting up a development
18-
environment <setup-dev-environment>`.
17+
.. Docs are always built on Python 3.12. See also the RTD and tox config.
18+
19+
To build Toga's documentation, start by :ref:`setting up a development environment
20+
<setup-dev-environment>`.You **must** have a Python 3.12 interpreter installed and
21+
available on your path (i.e., ``python3.12`` must start a Python 3.12 interpreter).
1922

2023
You'll also need to install the Enchant spell checking library.
2124

tox.ini

+9-14
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,11 @@ commands =
8282
[docs]
8383
docs_dir = {tox_root}{/}docs
8484
build_dir = {[docs]docs_dir}{/}_build
85-
# replace when Sphinx>=7.3 and Python 3.8 is dropped:
86-
# -T => --show-traceback
87-
# -W => --fail-on-warning
88-
# -b => --builder
89-
# -v => --verbose
90-
# -a => --write-all
91-
# -E => --fresh-env
92-
sphinx_args = -T -W --keep-going --jobs auto
85+
sphinx_args = --show-traceback --fail-on-warning --keep-going --jobs auto
9386

9487
[testenv:docs{,-lint,-all,-live,-live-src}]
88+
# Docs are always built on Python 3.12. See also the RTD config and contribution docs.
89+
base_python = py312
9590
skip_install = True
9691
# give sphinx-autobuild time to shutdown http server
9792
suicide_timeout = 1
@@ -104,9 +99,9 @@ passenv =
10499
# export PYENCHANT_LIBRARY_PATH=/opt/homebrew/lib/libenchant-2.2.dylib
105100
PYENCHANT_LIBRARY_PATH
106101
commands =
107-
!lint-!all-!live : python -m sphinx {[docs]sphinx_args} {posargs} -b html {[docs]docs_dir} {[docs]build_dir}{/}html
108-
lint : python -m sphinx {[docs]sphinx_args} {posargs} -b spelling {[docs]docs_dir} {[docs]build_dir}{/}spell
109-
lint : python -m sphinx {[docs]sphinx_args} {posargs} -b linkcheck {[docs]docs_dir} {[docs]build_dir}{/}links
110-
all : python -m sphinx {[docs]sphinx_args} {posargs} -v -a -E -b html {[docs]docs_dir} {[docs]build_dir}{/}html
111-
live-!src : sphinx-autobuild {[docs]sphinx_args} {posargs} -b html {[docs]docs_dir} {[docs]build_dir}{/}live
112-
live-src : sphinx-autobuild {[docs]sphinx_args} {posargs} -a -E --watch {tox_root}{/}core{/}src{/}toga -b html {[docs]docs_dir} {[docs]build_dir}{/}live
102+
!lint-!all-!live : python -m sphinx {[docs]sphinx_args} {posargs} --builder html {[docs]docs_dir} {[docs]build_dir}{/}html
103+
lint : python -m sphinx {[docs]sphinx_args} {posargs} --builder spelling {[docs]docs_dir} {[docs]build_dir}{/}spell
104+
lint : python -m sphinx {[docs]sphinx_args} {posargs} --builder linkcheck {[docs]docs_dir} {[docs]build_dir}{/}links
105+
all : python -m sphinx {[docs]sphinx_args} {posargs} --verbose --write-all --fresh-env --builder html {[docs]docs_dir} {[docs]build_dir}{/}html
106+
live-!src : sphinx-autobuild {[docs]sphinx_args} {posargs} --builder html {[docs]docs_dir} {[docs]build_dir}{/}live
107+
live-src : sphinx-autobuild {[docs]sphinx_args} {posargs} --write-all --fresh-env --watch {tox_root}{/}core{/}src{/}toga --builder html {[docs]docs_dir} {[docs]build_dir}{/}live

0 commit comments

Comments
 (0)