Skip to content

Commit 5797d88

Browse files
authored
Merge pull request #927 from bsipocz/MAINT_sphinx_dev
MAINT: adding sphinx9 and python3.14 support and bumping minimum sphinx to 7 and python to 3.11
2 parents 3437cf2 + f23d094 commit 5797d88

7 files changed

Lines changed: 23 additions & 24 deletions

File tree

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
os: [ubuntu-latest]
33-
python-version: ["3.11", "3.12", "3.13"]
33+
python-version: ["3.11", "3.12", "3.13", "3.14"]
3434
# Test last 2 major releases of Sphinx; regression fixtures target the latest.
35-
sphinx: ["~=7.0", "~=8.0"]
35+
sphinx: ["~=7.0", "~=8.0", "~=9.0"]
3636
include:
3737
- os: windows-latest
3838
python-version: 3.13
@@ -109,7 +109,7 @@ jobs:
109109
from pathlib import Path
110110
import re
111111
text = Path("./warnings.txt").read_text().strip()
112-
expected_warning_patterns = [r"kitchen\-sink", r"urllib/parse\.py", r"Glyph 10024 .*? missing from current font"]
112+
expected_warning_patterns = [r"kitchen\-sink", r"urllib/parse\.py", r"Glyph 10024 .*? missing from current font", r"list assignment index out of range \[autodoc\]"]
113113
print("\n=== Sphinx Warnings ===\n\n" + text) # Print just for reference so we can look at the logs
114114
unexpected = [l for l in text.splitlines() if not any(re.search(p, l) for p in expected_warning_patterns)]
115115
assert len(unexpected) == 0, unexpected

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2
44
build:
55
os: ubuntu-22.04
66
tools:
7-
python: "3.10"
7+
python: "3.12"
88

99
python:
1010
install:

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@
190190
linkcheck_ignore = [
191191
"http://someurl/release", # This is a fake link
192192
"https://doi.org", # These don't resolve properly and cause SSL issues
193+
"https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html", # anchors throw a 403 forbidden error
194+
"https://docutils.sourceforge.io/docs/ref/rst/directives.html", # anchors throw a 403 forbidden error
193195
]
194196
linkcheck_exclude_documents = ["changelog"]
195197

docs/contributing/tests.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ $ tox
1414
You can specify a specific environment like so:
1515

1616
```console
17-
# Run the tests with Python 3.10, Sphinx 6
18-
$ tox -e py310-sphinx6
17+
# Run the tests with Python 3.12, Sphinx 8
18+
$ tox -e py312-sphinx8
1919
```
2020

2121
## List all test environments
@@ -46,7 +46,7 @@ By default, `tox` will only install the necessary environment **once**.
4646
If you'd like to force a re-build, use the `-r` parameter. For example:
4747

4848
```console
49-
$ tox -r -e py310-sphinx6
49+
$ tox -r -e py312-sphinx8
5050
```
5151

5252
## Test audits with lighthouse
@@ -63,7 +63,7 @@ To preview the output of these tests:
6363

6464
## Test multiple Sphinx versions
6565

66-
This theme is tested against Sphinx 6-9.
66+
This theme is tested against Sphinx 7-9.
6767
We try to set up our regression tests such that there are no differences between these Sphinx versions.
6868

6969
### Unit tests

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ filterwarnings = [
2727
'''ignore:'sphinx.util.import_object' is deprecated.:PendingDeprecationWarning''',
2828
'ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning',
2929
'ignore:Argument "parser_name" will be removed in Docutils 2.0.:PendingDeprecationWarning',
30+
# RemovedInSphinx11Warning triggered in sphinx -- ultimately should be fixed
31+
"ignore:'sphinx_book_theme._transforms.HandleFootnoteTransform.app' is deprecated.:PendingDeprecationWarning",
3032
]
3133

3234
[project]
@@ -35,9 +37,9 @@ description = "A clean book theme for scientific explanations and documentation
3537
dynamic = ["version"]
3638
readme = "README.md"
3739

38-
requires-python = ">=3.9"
40+
requires-python = ">=3.11"
3941
dependencies = [
40-
"sphinx>=6.1",
42+
"sphinx>=7.0",
4143
"pydata-sphinx-theme==0.16.1"
4244
]
4345

@@ -61,7 +63,7 @@ code_style = [
6163
"pre-commit"
6264
]
6365
doc = [
64-
"ablog",
66+
"ablog>=0.11.13",
6567
"ipywidgets",
6668
"folium",
6769
"numpy",

tests/test_build.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99
import sphinx
1010
from sphinx.testing.util import SphinxTestApp
1111

12-
sphinx_version = parse(version("sphinx"))
13-
if sphinx_version.major < 7:
14-
from sphinx.testing.path import path as sphinx_path
15-
else:
16-
from pathlib import Path as sphinx_path
17-
1812

13+
sphinx_version = parse(version("sphinx"))
1914
path_tests = Path(__file__).parent
2015

2116

@@ -56,7 +51,7 @@ def html_tree(self, *path):
5651
def sphinx_build_factory(make_app, tmp_path):
5752
def _func(src_folder, **kwargs):
5853
copytree(path_tests / "sites" / src_folder, tmp_path / src_folder)
59-
app = make_app(srcdir=sphinx_path(tmp_path / src_folder), **kwargs)
54+
app = make_app(srcdir=Path(tmp_path / src_folder), **kwargs)
6055
return SphinxBuild(app, tmp_path / src_folder)
6156

6257
yield _func
@@ -469,7 +464,7 @@ def test_sidenote(sphinx_build_factory, file_regression):
469464
page2 = sphinx_build.html_tree("page2.html")
470465

471466
sidenote_html = page2.select("section > #sidenotes")
472-
regression_file = "test_sidenote_6" if sphinx_version.major < 7 else "test_sidenote"
467+
regression_file = "test_sidenote"
473468
file_regression.check(
474469
sidenote_html[0].prettify(),
475470
extension=".html",
@@ -487,9 +482,8 @@ def test_marginnote(sphinx_build_factory, file_regression):
487482
page2 = sphinx_build.html_tree("page2.html")
488483

489484
marginnote_html = page2.select("section > #marginnotes")
490-
regression_file = (
491-
"test_marginnote_6" if sphinx_version.major < 7 else "test_marginnote"
492-
)
485+
regression_file = "test_marginnote"
486+
493487
file_regression.check(
494488
marginnote_html[0].prettify(),
495489
extension=".html",

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ envlist = py313-sphinx8
1717
usedevelop=true
1818
passenv = TERM # To make terminal coloring / other variables pass through
1919

20-
[testenv:py{311,312,313}-pre-commit]
20+
[testenv:py{311,312,313,314}-pre-commit]
2121
extras = code_style
2222
commands = pre-commit run {posargs}
2323

@@ -60,9 +60,10 @@ commands =
6060
--re-ignore ".*\.pyc" \
6161
--re-ignore ".*~"
6262

63-
[testenv:py{311,312,313}-sphinx{7,8}]
63+
[testenv:py{311,312,313,314}-sphinx{7,8,9}]
6464
extras = test
6565
deps =
6666
sphinx7: sphinx>=7,<8
6767
sphinx8: sphinx>=8,<9
68+
sphinx9: sphinx>=9,<10
6869
commands = pytest {posargs}

0 commit comments

Comments
 (0)