Skip to content

Commit 4a5a20a

Browse files
jbms2bndy5
andauthored
Add support for Sphinx 8.2 (#410)
* Add support for Sphinx 8.2 This also changes the CI to use uv. Fixes #409. * Update .github/workflows/build.yml Co-authored-by: Brendan <[email protected]> --------- Co-authored-by: Brendan <[email protected]>
1 parent 4f7e08e commit 4a5a20a

39 files changed

+2876
-387
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "pip" # See documentation for possible values
9-
directory: "/" # recursive; requirements.txt in subdirectories are also monitored
10-
schedule:
11-
interval: "weekly"
12-
ignore:
13-
- dependency-name: sphinxcontrib-*help
14-
- dependency-name: sphinxcontrib-serializinghtml
8+
# Note: Disable dependabot for Python until uv support is available: https://github.com/dependabot/dependabot-core/issues/10478
9+
# - package-ecosystem: "pip" # See documentation for possible values
10+
# directory: "/" # recursive; requirements.txt in subdirectories are also monitored
11+
# schedule:
12+
# interval: "weekly"
13+
# ignore:
14+
# - dependency-name: sphinxcontrib-*help
15+
# - dependency-name: sphinxcontrib-serializinghtml
1516
# node.js dependencies are pinned to last merge from upstream.
1617
# - package-ecosystem: "npm"
1718
# directory: "/" # Location of package manifests

.github/workflows/build.yml

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,57 +14,60 @@ on:
1414
- cron: "0 0 1,16 * *"
1515

1616
jobs:
17+
mypy:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version:
23+
- "3.10"
24+
- "3.11"
25+
- "3.12"
26+
- "3.13"
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: astral-sh/setup-uv@v5
30+
with:
31+
enable-cache: false
32+
- name: Setup Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v5
34+
id: python-setup
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
- run: uvx nox -s mypy --python ${{ matrix.python-version }}
1738
check_conventions:
1839
runs-on: ubuntu-latest
1940
strategy:
2041
fail-fast: false
2142
matrix:
2243
include:
23-
- nox-sessions: "ruff_format ruff_lint check_yaml check_json check_toml check_eof check_trailing_space check_lf"
24-
python-version: "3.x"
44+
- python-version: "3.x"
2545
node-version: "16.x"
26-
- nox-sessions: "mypy"
27-
python-version: "3.9"
28-
- nox-sessions: "mypy"
29-
python-version: "3.10"
30-
- nox-sessions: "mypy"
31-
python-version: "3.11"
32-
- nox-sessions: "mypy"
33-
python-version: "3.12"
3446
steps:
3547
- uses: actions/checkout@v4
3648
- name: Setup Node.js
37-
if: matrix.node-version
3849
uses: actions/setup-node@v4
3950
with:
4051
node-version: ${{ matrix.node-version }}
52+
- uses: astral-sh/setup-uv@v5
53+
with:
54+
enable-cache: false
4155
- name: Setup Python ${{ matrix.python-version }}
4256
uses: actions/setup-python@v5
4357
id: python-setup
4458
with:
4559
python-version: ${{ matrix.python-version }}
4660
- name: Cache node.js modules
47-
if: matrix.node-version
4861
uses: actions/cache@v4
4962
with:
5063
path: "**/node_modules"
5164
key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
52-
- name: Cache nox environments
53-
uses: actions/cache@v4
54-
if: matrix.node-version
55-
with:
56-
path: |
57-
.nox/ruff_*
58-
.nox/check_*
59-
key: nox-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('requirements/dev-ruff.txt', 'requirements/dev-pre_commit_hooks.txt') }}
6065
- run: npm install
61-
if: matrix.node-version
6266
- run: npm run check
63-
if: matrix.node-version
64-
- run: pipx run nox -s ${{ matrix.nox-sessions }}
67+
- run: uvx nox -s ruff_format ruff_lint check_yaml check_json check_toml check_eof check_trailing_space check_lf
6568

6669
build:
67-
needs: [check_conventions]
70+
needs: ["mypy", "check_conventions"]
6871
strategy:
6972
fail-fast: false
7073
matrix:
@@ -86,6 +89,9 @@ jobs:
8689
uses: actions/setup-node@v4
8790
with:
8891
node-version: ${{ matrix.node-version }}
92+
- uses: astral-sh/setup-uv@v5
93+
with:
94+
enable-cache: false
8995
- name: Set up Python ${{ matrix.python-version }}
9096
uses: actions/setup-python@v5
9197
with:
@@ -98,19 +104,21 @@ jobs:
98104
- run: npm install
99105
- name: Check for dirty working directory
100106
run: git diff --exit-code
101-
- run: python -m pip install nox
102107
- name: Build distributions
103108
id: dist
104-
run: nox -s dist
109+
run: uvx nox -s build
105110
- name: Install wheel
106-
run: python -m pip install "${{ steps.dist.outputs.wheel }}"
111+
run: |
112+
uv venv install-test-venv
113+
export VIRTUAL_ENV="${PWD}/install-test-venv"
114+
uv pip install dist/*.whl
115+
shell: bash
107116
- name: Upload wheels as artifacts
108117
uses: actions/upload-artifact@v4
109118
with:
110119
name: python-packages-${{ runner.os }}
111120
path: |
112121
dist/*.whl
113-
dist/*.tar.*
114122
- name: Setup Graphviz
115123
uses: ts-graphviz/setup-graphviz@b1de5da23ed0a6d14e0aeee8ed52fdd87af2363c # v2.0.2
116124
with:
@@ -122,7 +130,7 @@ jobs:
122130
- name: Build docs
123131
env:
124132
SPHINX_IMMATERIAL_EXTERNAL_RESOURCE_CACHE_DIR: ${{ github.workspace }}/theme_build_cache
125-
run: nox -s docs --forcecolor
133+
run: uvx nox -s docs --forcecolor
126134
- name: Upload doc builds as artifacts
127135
uses: actions/upload-artifact@v4
128136
with:
@@ -136,7 +144,7 @@ jobs:
136144
publish_dir: ./docs/_build/html
137145

138146
test:
139-
needs: [check_conventions, build]
147+
needs: ["build"]
140148
strategy:
141149
fail-fast: false
142150
matrix:
@@ -145,10 +153,10 @@ jobs:
145153
- "windows-latest"
146154
- "macos-latest"
147155
python-version:
148-
- "3.9"
149156
- "3.10"
150157
- "3.11"
151158
- "3.12"
159+
- "3.13"
152160
node-version:
153161
- "16.x"
154162
runs-on: ${{ matrix.os }}
@@ -157,6 +165,9 @@ jobs:
157165
- uses: actions/setup-node@v4
158166
with:
159167
node-version: ${{ matrix.node-version }}
168+
- uses: astral-sh/setup-uv@v5
169+
with:
170+
enable-cache: false
160171
- name: Setup python
161172
uses: actions/setup-python@v5
162173
with:
@@ -183,7 +194,7 @@ jobs:
183194
COVERAGE_FILE: .coverage.${{ github.run_id }}.${{ github.run_attempt }}.${{ runner.os }}.${{ matrix.python-version }}
184195
PY_COLORS: 1
185196
# `coverage run` cmd adds the working dir to python path, so no need to install pkg here
186-
run: pipx run nox -s tests --forcecolor --python ${{ matrix.python-version }}
197+
run: uvx nox -s tests --forcecolor --python ${{ matrix.python-version }}
187198
- name: Upload coverage data
188199
uses: actions/upload-artifact@v4
189200
with:
@@ -202,12 +213,15 @@ jobs:
202213
path: ci-artifacts
203214
pattern: coverage-data-*
204215
- run: mv ci-artifacts/**/.coverage* ./
216+
- uses: astral-sh/setup-uv@v5
217+
with:
218+
enable-cache: false
205219
- name: Setup python
206220
uses: actions/setup-python@v5
207221
with:
208222
python-version: "3.x"
209223
- name: Create coverage report
210-
run: pipx run nox -s coverage
224+
run: uvx nox -s coverage
211225
- name: Post coverage summary
212226
if: github.repository == 'jbms/sphinx-immaterial'
213227
uses: codecov/codecov-action@v4

.readthedocs.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@ version: 2
77

88
# Set the version of Python and other tools you might need
99
build:
10-
os: ubuntu-20.04
10+
os: ubuntu-24.04
1111
tools:
12-
python: "3.9"
12+
python: "3.13"
1313
nodejs: "16"
1414
apt_packages:
1515
- graphviz
16+
jobs:
17+
post_install:
18+
- pip install uv
19+
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --all-extras --group docs --link-mode=copy
20+
1621

1722
# Build documentation in the docs/ directory with Sphinx
1823
sphinx:
1924
configuration: docs/conf.py
20-
21-
# Optionally declare the Python requirements required to build your docs
22-
python:
23-
install:
24-
- method: setuptools
25-
path: .
26-
- requirements: docs/requirements.txt

dev-requirements.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/conf.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,15 @@ def _parse_confval_signature(
569569
default = registry_option.default
570570
types = registry_option.valid_types
571571
if isinstance(types, sphinx.config.ENUM):
572-
types = (typing.Literal[tuple(types.candidates)],)
572+
types = (
573+
typing.Literal[
574+
tuple(
575+
getattr(types, "candidates", None)
576+
# Attribute renamed to "_candidates" in Sphinx>=8.2
577+
or getattr(types, "_candidates", None)
578+
)
579+
],
580+
)
573581
if isinstance(types, type):
574582
types = (types,)
575583
if types:

docs/requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

dprint.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"plugins": [
3+
// specify plugin urls here
4+
"https://plugins.dprint.dev/toml-0.6.3.wasm"
5+
]
6+
}

0 commit comments

Comments
 (0)