Skip to content

Commit 36d3378

Browse files
authored
⬆️ Update sphinx v8 and test dependency versions (#212)
Support sphinx v8, drop v5
1 parent a3bdfa3 commit 36d3378

File tree

8 files changed

+55
-25
lines changed

8 files changed

+55
-25
lines changed

.github/workflows/ci.yml

+16-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Set up Python 3.9
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: 3.9
2222
- uses: pre-commit/action@v3.0.1
@@ -29,30 +29,36 @@ jobs:
2929
os: [ubuntu-latest]
3030
python-version: ["3.9", "3.10", "3.11", "3.12"]
3131
sphinx-version: ["~=7.0"]
32+
extras: ["testing"]
3233
include:
3334
- os: ubuntu-latest
34-
python-version: 3.9
35-
sphinx-version: "~=5.0"
36-
- os: ubuntu-latest
37-
python-version: 3.9
35+
python-version: "3.9"
3836
sphinx-version: "~=6.0"
37+
extras: "testing"
38+
- os: ubuntu-latest
39+
python-version: "3.10"
40+
sphinx-version: "~=8.0"
41+
extras: "testing-no-myst" # TODO myst does not yet support Sphinx 8.0
3942
- os: windows-latest
40-
python-version: 3.9
43+
python-version: "3.9"
4144
sphinx-version: "~=7.0"
45+
extras: "testing"
4246

4347
runs-on: ${{ matrix.os }}
4448

49+
name: Tests (py${{ matrix.python-version }}, Sphinx${{ matrix.sphinx-version }}, on ${{ matrix.os }})
50+
4551
steps:
4652
- uses: actions/checkout@v4
4753
- name: Set up Python ${{ matrix.python-version }}
48-
uses: actions/setup-python@v4
54+
uses: actions/setup-python@v5
4955
with:
5056
python-version: ${{ matrix.python-version }}
5157
cache: pip
5258
- name: Install dependencies
5359
run: |
5460
python -m pip install --upgrade pip
55-
pip install --upgrade "sphinx${{ matrix.sphinx-version }}" -e .[testing]
61+
pip install --upgrade "sphinx${{ matrix.sphinx-version }}" -e .[${{ matrix.extras}}]
5662
- name: Run pytest
5763
run: |
5864
pytest --cov=sphinx_design --cov-report=xml --cov-report=term-missing
@@ -76,7 +82,7 @@ jobs:
7682
steps:
7783
- uses: actions/checkout@v4
7884
- name: Set up Python 3.9
79-
uses: actions/setup-python@v4
85+
uses: actions/setup-python@v5
8086
with:
8187
python-version: "3.9"
8288
cache: pip
@@ -115,7 +121,7 @@ jobs:
115121
- name: Checkout source
116122
uses: actions/checkout@v4
117123
- name: Set up Python
118-
uses: actions/setup-python@v4
124+
uses: actions/setup-python@v5
119125
with:
120126
python-version: 3.9
121127
- name: install flit

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ repos:
1919
- id: trailing-whitespace
2020

2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.4.4
22+
rev: v0.5.5
2323
hooks:
2424
- id: ruff
2525
args: [--fix]
2626
- id: ruff-format
2727

2828
- repo: https://github.com/pre-commit/mirrors-mypy
29-
rev: v1.10.0
29+
rev: v1.11.1
3030
hooks:
3131
- id: mypy
3232
additional_dependencies: []

.readthedocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: "3.9"
6+
python: "3.10"
77

88
python:
99
install:

codecov.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ coverage:
22
status:
33
project:
44
default:
5-
target: 90%
5+
target: 85%
66
threshold: 0.2%
77
patch:
88
default:

pyproject.toml

+13-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ classifiers = [
1919
"Programming Language :: Python :: 3.10",
2020
"Programming Language :: Python :: 3.11",
2121
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
2223
"Programming Language :: Python :: Implementation :: CPython",
2324
"Topic :: Software Development :: Libraries :: Python Modules",
2425
"Topic :: Text Processing :: Markup",
@@ -27,28 +28,34 @@ classifiers = [
2728
]
2829
keywords = ["sphinx", "extension", "material design", "web components"]
2930
requires-python = ">=3.9"
30-
dependencies = ["sphinx>=5,<8"]
31+
dependencies = ["sphinx>=6,<9"]
3132

3233
[project.urls]
3334
Homepage = "https://github.com/executablebooks/sphinx-design"
3435
Documentation = "https://sphinx-design.readthedocs.io"
3536

3637
[project.optional-dependencies]
3738
code-style = ["pre-commit>=3,<4"]
38-
rtd = ["myst-parser>=1,<3"]
39+
rtd = ["myst-parser>=2,<4"]
3940
testing = [
40-
"myst-parser>=1,<3",
41-
"pytest~=7.1",
41+
"myst-parser>=2,<4",
42+
"pytest~=8.3",
43+
"pytest-cov",
44+
"pytest-regressions",
45+
"defusedxml",
46+
]
47+
testing-no-myst = [
48+
"pytest~=8.3",
4249
"pytest-cov",
4350
"pytest-regressions",
4451
"defusedxml",
4552
]
4653

47-
theme-furo = ["furo~=2024.5.4"]
54+
theme-furo = ["furo~=2024.7.18"]
4855
theme-pydata = ["pydata-sphinx-theme~=0.15.2"]
4956
theme-rtd = ["sphinx-rtd-theme~=2.0"]
5057
theme-sbt = ["sphinx-book-theme~=1.1"]
51-
theme-im = ["sphinx-immaterial~=0.11.11"]
58+
theme-im = ["sphinx-immaterial~=0.12.2"]
5259

5360
[tool.flit.sdist]
5461
exclude = [

sphinx_design/cards.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def split_content(content: StringList, offset: int) -> CardContent:
226226
return CardContent(body, header, footer)
227227

228228
@classmethod
229-
def _create_component( # noqa: PLR0913
229+
def _create_component(
230230
cls,
231231
inst: SphinxDirective,
232232
name: str,

tests/test_snippets.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77

88
from .conftest import SphinxBuilder
99

10+
try:
11+
import myst_parser # noqa: F401
12+
13+
MYST_INSTALLED = True
14+
except ImportError:
15+
MYST_INSTALLED = False
16+
1017
SNIPPETS_PATH = Path(__file__).parent.parent / "docs" / "snippets"
1118
SNIPPETS_GLOB_RST = list((SNIPPETS_PATH / "rst").glob("[!_]*"))
1219
SNIPPETS_GLOB_MYST = list((SNIPPETS_PATH / "myst").glob("[!_]*"))
@@ -29,7 +36,7 @@ def test_snippets_rst(
2936
sphinx_builder: Callable[..., SphinxBuilder], path: Path, file_regression
3037
):
3138
"""Test snippets written in RestructuredText (before post-transforms)."""
32-
builder = sphinx_builder()
39+
builder = sphinx_builder(conf_kwargs={"extensions": ["sphinx_design"]})
3340
content = "Heading\n-------" + "\n\n" + path.read_text(encoding="utf8")
3441
builder.src_path.joinpath("index.rst").write_text(content, encoding="utf8")
3542
write_assets(builder.src_path)
@@ -49,6 +56,7 @@ def test_snippets_rst(
4956
SNIPPETS_GLOB_MYST,
5057
ids=[path.name[: -len(path.suffix)] for path in SNIPPETS_GLOB_MYST],
5158
)
59+
@pytest.mark.skipif(not MYST_INSTALLED, reason="myst-parser not installed")
5260
def test_snippets_myst(
5361
sphinx_builder: Callable[..., SphinxBuilder], path: Path, file_regression
5462
):
@@ -77,7 +85,7 @@ def test_snippets_rst_post(
7785
sphinx_builder: Callable[..., SphinxBuilder], path: Path, file_regression
7886
):
7987
"""Test snippets written in RestructuredText (after HTML post-transforms)."""
80-
builder = sphinx_builder()
88+
builder = sphinx_builder(conf_kwargs={"extensions": ["sphinx_design"]})
8189
content = "Heading\n-------" + "\n\n" + path.read_text(encoding="utf8")
8290
builder.src_path.joinpath("index.rst").write_text(content, encoding="utf8")
8391
write_assets(builder.src_path)
@@ -97,6 +105,7 @@ def test_snippets_rst_post(
97105
SNIPPETS_GLOB_MYST,
98106
ids=[path.name[: -len(path.suffix)] for path in SNIPPETS_GLOB_MYST],
99107
)
108+
@pytest.mark.skipif(not MYST_INSTALLED, reason="myst-parser not installed")
100109
def test_snippets_myst_post(
101110
sphinx_builder: Callable[..., SphinxBuilder], path: Path, file_regression
102111
):
@@ -120,7 +129,7 @@ def test_sd_hide_title_rst(
120129
sphinx_builder: Callable[..., SphinxBuilder], file_regression
121130
):
122131
"""Test that the root title is hidden."""
123-
builder = sphinx_builder()
132+
builder = sphinx_builder(conf_kwargs={"extensions": ["sphinx_design"]})
124133
content = ":sd_hide_title:\n\nHeading\n-------\n\ncontent"
125134
builder.src_path.joinpath("index.rst").write_text(content, encoding="utf8")
126135
builder.build()
@@ -134,6 +143,7 @@ def test_sd_hide_title_rst(
134143
)
135144

136145

146+
@pytest.mark.skipif(not MYST_INSTALLED, reason="myst-parser not installed")
137147
def test_sd_hide_title_myst(
138148
sphinx_builder: Callable[..., SphinxBuilder], file_regression
139149
):
@@ -152,6 +162,7 @@ def test_sd_hide_title_myst(
152162
)
153163

154164

165+
@pytest.mark.skipif(not MYST_INSTALLED, reason="myst-parser not installed")
155166
def test_sd_custom_directives(
156167
sphinx_builder: Callable[..., SphinxBuilder], file_regression
157168
):

tox.ini

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ envlist = py39
88
[testenv]
99
usedevelop = true
1010

11-
[testenv:py{39,310,311,312}]
11+
[testenv:py{39,310,311,312,313}]
1212
description = Run unit tests with this Python version
1313
extras =
1414
testing
1515
commands = pytest {posargs}
1616

17+
[testenv:py{39,310,311,312,313}-no-myst]
18+
description = Run unit tests with this Python version
19+
extras =
20+
testing-no-myst
21+
commands = pytest {posargs}
22+
1723
[testenv:docs-{alabaster,rtd,pydata,sbt,furo,im}]
1824
description =
1925
Run documentation build for this theme

0 commit comments

Comments
 (0)