Skip to content

Commit 64ed88f

Browse files
authored
fix _Opt deprecation warning (#236)
* fix _Opt deprecation warning closes #234 * build(deps): docs * ci(docs): build on Python 3.12
1 parent bf8ef76 commit 64ed88f

File tree

3 files changed

+48
-50
lines changed

3 files changed

+48
-50
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
version: py312
5050
docs:
5151
docker:
52-
- image: 'cimg/python:3.11'
52+
- image: 'cimg/python:3.12'
5353
steps:
5454
- checkout
5555
- run: pip install --user tox

docs/requirements.txt

+25-38
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,75 @@
11
#
2-
# This file is autogenerated by pip-compile with python 3.10
3-
# To update, run:
2+
# This file is autogenerated by pip-compile with Python 3.12
3+
# by the following command:
44
#
55
# pip-compile --extra=doc --output-file=docs/requirements.txt pyproject.toml
66
#
7-
alabaster==0.7.13
7+
alabaster==0.7.16
88
# via sphinx
9-
anyascii==0.3.2
9+
astroid==3.2.2
1010
# via sphinx-autoapi
11-
astroid==2.15.6
12-
# via sphinx-autoapi
13-
babel==2.12.1
11+
babel==2.15.0
1412
# via sphinx
15-
certifi==2023.7.22
13+
certifi==2024.2.2
1614
# via requests
17-
charset-normalizer==3.2.0
15+
charset-normalizer==3.3.2
1816
# via requests
19-
docutils==0.18.1
17+
docutils==0.20.1
2018
# via
2119
# sphinx
2220
# sphinx-rtd-theme
2321
# sphinx-tabs
24-
idna==3.4
22+
idna==3.7
2523
# via requests
2624
imagesize==1.4.1
2725
# via sphinx
28-
jinja2==3.1.2
26+
jinja2==3.1.4
2927
# via
3028
# sphinx
3129
# sphinx-autoapi
32-
lazy-object-proxy==1.9.0
33-
# via astroid
34-
markupsafe==2.1.3
30+
markupsafe==2.1.5
3531
# via jinja2
36-
packaging==23.1
32+
packaging==24.0
3733
# via sphinx
38-
pygments==2.16.1
34+
pygments==2.18.0
3935
# via
4036
# sphinx
4137
# sphinx-tabs
4238
pyyaml==6.0.1
4339
# via sphinx-autoapi
44-
requests==2.31.0
40+
requests==2.32.2
4541
# via sphinx
4642
snowballstemmer==2.2.0
4743
# via sphinx
48-
sphinx==7.2.3
44+
sphinx==7.3.7
4945
# via
5046
# sphinx-autoapi
5147
# sphinx-notfound-page (pyproject.toml)
5248
# sphinx-rtd-theme
5349
# sphinx-tabs
54-
# sphinxcontrib-applehelp
55-
# sphinxcontrib-devhelp
56-
# sphinxcontrib-htmlhelp
5750
# sphinxcontrib-jquery
58-
# sphinxcontrib-qthelp
59-
# sphinxcontrib-serializinghtml
6051
# sphinxemoji
61-
sphinx-autoapi==2.1.1
52+
sphinx-autoapi==3.1.1
6253
# via sphinx-notfound-page (pyproject.toml)
63-
sphinx-rtd-theme==1.3.0
54+
sphinx-rtd-theme==2.0.0
6455
# via sphinx-notfound-page (pyproject.toml)
65-
sphinx-tabs==3.4.1
56+
sphinx-tabs==3.4.5
6657
# via sphinx-notfound-page (pyproject.toml)
67-
sphinxcontrib-applehelp==1.0.7
58+
sphinxcontrib-applehelp==1.0.8
6859
# via sphinx
69-
sphinxcontrib-devhelp==1.0.5
60+
sphinxcontrib-devhelp==1.0.6
7061
# via sphinx
71-
sphinxcontrib-htmlhelp==2.0.4
62+
sphinxcontrib-htmlhelp==2.0.5
7263
# via sphinx
7364
sphinxcontrib-jquery==4.1
7465
# via sphinx-rtd-theme
7566
sphinxcontrib-jsmath==1.0.1
7667
# via sphinx
77-
sphinxcontrib-qthelp==1.0.6
68+
sphinxcontrib-qthelp==1.0.7
7869
# via sphinx
79-
sphinxcontrib-serializinghtml==1.1.9
70+
sphinxcontrib-serializinghtml==1.1.10
8071
# via sphinx
81-
sphinxemoji==0.2.0
72+
sphinxemoji==0.3.1
8273
# via sphinx-notfound-page (pyproject.toml)
83-
typing-extensions==4.7.1
84-
# via astroid
85-
urllib3==2.0.4
74+
urllib3==2.2.1
8675
# via requests
87-
wrapt==1.15.0
88-
# via astroid

notfound/extension.py

+22-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import html
2-
import docutils.nodes
32
import os
43
import warnings
54

5+
import docutils.nodes
66
import sphinx
77
from sphinx.environment.collectors import EnvironmentCollector
88
from sphinx.errors import ExtensionError
@@ -13,7 +13,6 @@
1313

1414
class BaseURIError(ExtensionError):
1515
"""Exception for malformed base URI."""
16-
pass
1716

1817

1918
# https://www.sphinx-doc.org/en/stable/extdev/appapi.html#event-html-collect-pages
@@ -167,7 +166,11 @@ def toctree(*args, **kwargs):
167166
# We have to overwrite them here to use our own `pathto` function.
168167
# The code is borrowed exactly from Sphinx 7.2.2, there is no changes.
169168
if sphinx.version_info >= (7, 2):
170-
from sphinx.builders.html._assets import _CascadingStyleSheet, _file_checksum, _JavaScript
169+
from sphinx.builders.html._assets import (
170+
_CascadingStyleSheet,
171+
_file_checksum,
172+
_JavaScript,
173+
)
171174

172175
outdir = app.outdir
173176

@@ -266,14 +269,22 @@ def validate_configs(app, *args, **kwargs):
266269
267270
Shows a warning if one of the configs is not valid.
268271
"""
269-
default, rebuild, types = app.config.values.get('notfound_urls_prefix')
270-
if app.config.notfound_urls_prefix != default:
271-
if app.config.notfound_urls_prefix and not all([
272-
app.config.notfound_urls_prefix.startswith('/'),
273-
app.config.notfound_urls_prefix.endswith('/'),
274-
]):
275-
message = 'notfound_urls_prefix should start and end with "/" (slash)'
276-
warnings.warn(message, UserWarning, stacklevel=2)
272+
notfound_urls_prefix = app.config.notfound_urls_prefix
273+
default = (
274+
app.config.values.get("notfound_urls_prefix").default
275+
if sphinx.version_info >= (7, 2)
276+
else app.config.values.get("notfound_urls_prefix")[0]
277+
)
278+
279+
if (
280+
notfound_urls_prefix != default
281+
and notfound_urls_prefix
282+
and not (
283+
notfound_urls_prefix.startswith("/") or notfound_urls_prefix.endswith("/")
284+
)
285+
):
286+
message = 'notfound_urls_prefix should start and end with "/" (slash)'
287+
warnings.warn(message, UserWarning, stacklevel=2)
277288

278289

279290
def setup(app):

0 commit comments

Comments
 (0)