Skip to content

Commit caad11f

Browse files
committed
Update tox configuration and appease mypy.
1 parent b3ff18c commit caad11f

File tree

7 files changed

+38
-47
lines changed

7 files changed

+38
-47
lines changed

repo_helper.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,8 @@ intersphinx_mapping:
224224
exclude_files:
225225
- contributing
226226
- doc_requirements
227-
- tox
227+
228+
tox_unmanaged:
229+
- testenv
230+
- fixups
231+
- pytest

sphinx_toolbox/more_autodoc/autonamedtuple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def filter_members(
298298
new_hints = get_type_hints(
299299
self.object.__new__,
300300
globalns=sys.modules[self.object.__module__].__dict__,
301-
localns=self.object.__dict__, # type: ignore[arg-type]
301+
localns=self.object.__dict__,
302302
)
303303

304304
# Stock NamedTuples don't have these, but customised collections.namedtuple or hand-rolled classes may

sphinx_toolbox/more_autodoc/regex.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -613,15 +613,15 @@ class HTMLRegexParser(RegexParser):
613613
"""
614614

615615
# Colours
616-
AT_COLOUR = span("regex regex_at")
617-
SUBPATTERN_COLOUR = span("regex regex_subpattern")
618-
IN_COLOUR = span("regex regex_in")
619-
REPEAT_COLOUR = span("regex regex_repeat")
620-
REPEAT_BRACE_COLOUR = span("regex regex_repeat_brace")
621-
CATEGORY_COLOUR = span("regex regex_category")
622-
BRANCH_COLOUR = span("regex regex_branch")
623-
LITERAL_COLOUR = span("regex regex_literal")
624-
ANY_COLOUR = span("regex regex_any")
616+
AT_COLOUR: Callable[[Any], str] = span("regex regex_at")
617+
SUBPATTERN_COLOUR: Callable[[Any], str] = span("regex regex_subpattern")
618+
IN_COLOUR: Callable[[Any], str] = span("regex regex_in")
619+
REPEAT_COLOUR: Callable[[Any], str] = span("regex regex_repeat")
620+
REPEAT_BRACE_COLOUR: Callable[[Any], str] = span("regex regex_repeat_brace")
621+
CATEGORY_COLOUR: Callable[[Any], str] = span("regex regex_category")
622+
BRANCH_COLOUR: Callable[[Any], str] = span("regex regex_branch")
623+
LITERAL_COLOUR: Callable[[Any], str] = span("regex regex_literal")
624+
ANY_COLOUR: Callable[[Any], str] = span("regex regex_any")
625625

626626
def parse_pattern(self, regex: Pattern) -> str:
627627
"""
@@ -660,15 +660,15 @@ class LaTeXRegexParser(RegexParser):
660660
"""
661661

662662
# Colours
663-
AT_COLOUR = latex_textcolor("regex_at")
664-
SUBPATTERN_COLOUR = latex_textcolor("regex_subpattern")
665-
IN_COLOUR = latex_textcolor("regex_in")
666-
REPEAT_COLOUR = latex_textcolor("regex_repeat")
667-
REPEAT_BRACE_COLOUR = latex_textcolor("regex_repeat_brace")
668-
CATEGORY_COLOUR = latex_textcolor("regex_category")
669-
BRANCH_COLOUR = latex_textcolor("regex_branch")
670-
LITERAL_COLOUR = latex_textcolor("regex_literal")
671-
ANY_COLOUR = latex_textcolor("regex_any")
663+
AT_COLOUR: Callable[[Any], str] = latex_textcolor("regex_at")
664+
SUBPATTERN_COLOUR: Callable[[Any], str] = latex_textcolor("regex_subpattern")
665+
IN_COLOUR: Callable[[Any], str] = latex_textcolor("regex_in")
666+
REPEAT_COLOUR: Callable[[Any], str] = latex_textcolor("regex_repeat")
667+
REPEAT_BRACE_COLOUR: Callable[[Any], str] = latex_textcolor("regex_repeat_brace")
668+
CATEGORY_COLOUR: Callable[[Any], str] = latex_textcolor("regex_category")
669+
BRANCH_COLOUR: Callable[[Any], str] = latex_textcolor("regex_branch")
670+
LITERAL_COLOUR: Callable[[Any], str] = latex_textcolor("regex_literal")
671+
ANY_COLOUR: Callable[[Any], str] = latex_textcolor("regex_any")
672672

673673
def parse_pattern(self, regex: Pattern) -> str:
674674
"""

sphinx_toolbox/more_autosummary/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def create_documenter( # type: ignore[override]
354354

355355
else:
356356

357-
def create_documenter( # type: ignore[misc]
357+
def create_documenter( # type: ignore[misc,override]
358358
self,
359359
app: Sphinx,
360360
obj: Any,

tests/test_issues_output/test_source_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_html_output(gh_src_app: Sphinx, html_regression: HTMLRegressionFixture)
105105
page = pytest.param(page, id=page)
106106

107107
pagename: str = page.values[0] # type: ignore[assignment]
108-
page_id: str = page.id or pagename
108+
page_id: str = cast(str, page.id or pagename)
109109
for mark in page.marks:
110110
if mark.kwargs.get("condition", False):
111111
if "reason" in mark.kwargs:

tests/test_output/test_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_html_output(
162162

163163
for page in pages_to_check:
164164
pagename: str = page.values[0] # type: ignore[assignment]
165-
page_id: str = page.id or pagename
165+
page_id: str = cast(str, page.id or pagename)
166166

167167
for mark in page.marks:
168168
if mark.kwargs.get("condition", False):

tox.ini

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ envlist =
2626
py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4}
2727
py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1}
2828
py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2}
29-
py312-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2}
29+
py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2}
3030
py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2}
3131
pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3}
3232
pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1}
@@ -48,33 +48,20 @@ test =
4848
py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4}
4949
py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1}
5050
py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2}
51-
py312-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2}
51+
py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2}
5252
py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2}
5353
pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3}
5454
pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1}
5555
pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4}
5656
qa = mypy, lint
57-
cov = py38-sphinx3.2, coverage
57+
cov = py39-sphinx3.2, coverage
5858
raspi = py3{7,8,9,10}-sphinx4.5
5959

6060
[testenv:.package]
6161
setenv =
6262
PYTHONDEVMODE=1
6363
PIP_DISABLE_PIP_VERSION_CHECK=1
6464

65-
[testenv:py313]
66-
download = True
67-
setenv =
68-
PYTHONDEVMODE=1
69-
PIP_DISABLE_PIP_VERSION_CHECK=1
70-
UNSAFE_PYO3_SKIP_VERSION_CHECK=1
71-
72-
[testenv:py312]
73-
download = True
74-
setenv =
75-
PYTHONDEVMODE=1
76-
PIP_DISABLE_PIP_VERSION_CHECK=1
77-
7865
[testenv:docs]
7966
setenv = SHOW_TODOS = 1
8067
passenv = SPHINX_BUILDER
@@ -103,7 +90,7 @@ commands =
10390
check-wheel-contents dist/
10491

10592
[testenv:lint]
106-
basepython = python3.8
93+
basepython = python3.9
10794
changedir = {toxinidir}
10895
ignore_errors = True
10996
skip_install = True
@@ -127,32 +114,32 @@ deps =
127114
git+https://github.com/domdfcoding/flake8-rst-docstrings.git
128115
git+https://github.com/python-formate/flake8-unused-arguments.git@magic-methods
129116
git+https://github.com/python-formate/flake8-missing-annotations.git
130-
pydocstyle>=6.0.0
117+
git+https://github.com/domdfcoding/pydocstyle.git@stub-functions
131118
pygments>=2.7.1
132119
importlib_metadata<4.5.0; python_version<'3.8'
133120
commands = python3 -m flake8_rst_docstrings_sphinx sphinx_toolbox tests --allow-toolbox {posargs}
134121

135122
[testenv:perflint]
136-
basepython = python3.8
123+
basepython = python3.9
137124
changedir = {toxinidir}
138125
ignore_errors = True
139126
skip_install = True
140127
deps = perflint
141128
commands = python3 -m perflint sphinx_toolbox {posargs}
142129

143130
[testenv:mypy]
144-
basepython = python3.8
131+
basepython = python3.9
145132
ignore_errors = True
146133
changedir = {toxinidir}
147134
extras = all
148135
deps =
149-
mypy==1.11.0
136+
mypy==1.16
150137
-r{toxinidir}/tests/requirements.txt
151138
-r{toxinidir}/stubs.txt
152139
commands = mypy sphinx_toolbox tests {posargs}
153140

154141
[testenv:pyup]
155-
basepython = python3.8
142+
basepython = python3.9
156143
skip_install = True
157144
ignore_errors = True
158145
changedir = {toxinidir}
@@ -161,7 +148,7 @@ extras = all
161148
commands = pyup_dirs sphinx_toolbox tests --py36-plus --recursive
162149

163150
[testenv:coverage]
164-
basepython = python3.8
151+
basepython = python3.9
165152
skip_install = True
166153
ignore_errors = True
167154
whitelist_externals = /bin/bash
@@ -340,7 +327,6 @@ commands =
340327
[pytest]
341328
addopts = --color yes --durations 25
342329
timeout = 600
343-
markers = sphinx
344330
filterwarnings =
345331
error
346332
ignore:distutils Version classes are deprecated. Use packaging.version instead.:DeprecationWarning
@@ -364,3 +350,4 @@ filterwarnings =
364350
always:'parser.split_opt' is deprecated and will be removed in Click 9.0. The old parser is available in 'optparse'.:DeprecationWarning
365351
always:'OptionParser' is deprecated and will be removed in Click 9.0. The old parser is available in 'optparse'.:DeprecationWarning
366352
always:The '__version__' attribute is deprecated and will be removed in Click 9.1..:DeprecationWarning
353+
markers = sphinx

0 commit comments

Comments
 (0)