Skip to content

Commit 7684520

Browse files
authored
Support Sphinx 7.3 and drop 3.8 support (#448)
1 parent a79c4c1 commit 7684520

File tree

8 files changed

+185
-121
lines changed

8 files changed

+185
-121
lines changed

Diff for: .github/workflows/check.yml

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
- "3.11"
2525
- "3.10"
2626
- "3.9"
27-
- "3.8"
2827
steps:
2928
- name: Setup python for tox
3029
uses: actions/setup-python@v5

Diff for: .pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: end-of-file-fixer
66
- id: trailing-whitespace
77
- repo: https://github.com/python-jsonschema/check-jsonschema
8-
rev: 0.28.1
8+
rev: 0.28.2
99
hooks:
1010
- id: check-github-workflows
1111
args: [ "--verbose" ]
@@ -20,12 +20,12 @@ repos:
2020
- id: tox-ini-fmt
2121
args: ["-p", "fix"]
2222
- repo: https://github.com/tox-dev/pyproject-fmt
23-
rev: "1.7.0"
23+
rev: "1.8.0"
2424
hooks:
2525
- id: pyproject-fmt
26-
additional_dependencies: ["tox>=4.13"]
26+
additional_dependencies: ["tox>=4.14.2"]
2727
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: "v0.3.5"
28+
rev: "v0.3.7"
2929
hooks:
3030
- id: ruff-format
3131
- id: ruff

Diff for: pyproject.toml

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
build-backend = "hatchling.build"
33
requires = [
44
"hatch-vcs>=0.4",
5-
"hatchling>=1.21.1",
5+
"hatchling>=1.24",
66
]
77

88
[project]
@@ -19,15 +19,14 @@ keywords = [
1919
license = "MIT"
2020
maintainers = [{ name = "Bernát Gábor", email = "[email protected]" }]
2121
authors = [{ name = "Bernát Gábor", email = "[email protected]" }]
22-
requires-python = ">=3.8"
22+
requires-python = ">=3.9"
2323
classifiers = [
2424
"Development Status :: 5 - Production/Stable",
2525
"Framework :: Sphinx :: Extension",
2626
"Intended Audience :: Developers",
2727
"License :: OSI Approved :: MIT License",
2828
"Programming Language :: Python",
2929
"Programming Language :: Python :: 3 :: Only",
30-
"Programming Language :: Python :: 3.8",
3130
"Programming Language :: Python :: 3.9",
3231
"Programming Language :: Python :: 3.10",
3332
"Programming Language :: Python :: 3.11",
@@ -38,7 +37,7 @@ dynamic = [
3837
"version",
3938
]
4039
dependencies = [
41-
"Sphinx>=7.1.2",
40+
"Sphinx>=7.3.5",
4241
]
4342
optional-dependencies.docs = [
4443
"furo>=2024.1.29",
@@ -48,12 +47,13 @@ optional-dependencies.numpy = [
4847
]
4948
optional-dependencies.testing = [
5049
"covdefaults>=2.3",
51-
"coverage>=7.4.2",
52-
"diff-cover>=8.0.3",
53-
"pytest>=8.0.1",
54-
"pytest-cov>=4.1",
50+
"coverage>=7.4.4",
51+
"defusedxml>=0.7.1", # required by sphinx.testing
52+
"diff-cover>=9",
53+
"pytest>=8.1.1",
54+
"pytest-cov>=5",
5555
"sphobjinv>=2.3.1",
56-
"typing-extensions>=4.9",
56+
"typing-extensions>=4.11",
5757
]
5858
urls.Changelog = "https://github.com/tox-dev/sphinx-autodoc-typehints/blob/main/CHANGELOG.md"
5959
urls.Homepage = "https://github.com/tox-dev/sphinx-autodoc-typehints"
@@ -69,7 +69,7 @@ line-length = 120
6969

7070
[tool.ruff]
7171
line-length = 120
72-
target-version = "py38"
72+
target-version = "py39"
7373
lint.select = ["ALL"]
7474
lint.isort = { known-first-party = [
7575
"sphinx_autodoc_typehints",

Diff for: src/sphinx_autodoc_typehints/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,9 @@ def format_annotation(annotation: Any, config: Config) -> str: # noqa: C901, PL
266266
else:
267267
fmt = [format_annotation(arg, config) for arg in args]
268268
formatted_args = args_format.format(", ".join(fmt))
269-
if formatted_args:
270-
formatted_args = "\\ " + formatted_args
271269

272-
return f":py:{role}:`{prefix}{full_name}`{formatted_args}"
270+
escape = "\\ " if formatted_args else ""
271+
return f":py:{role}:`{prefix}{full_name}`{escape}{formatted_args}"
273272

274273

275274
# reference: https://github.com/pytorch/pytorch/pull/46548/files

Diff for: src/sphinx_autodoc_typehints/patches.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def napoleon_numpy_docstring_return_type_processor( # noqa: PLR0913, PLR0917
5959
# Napoleon allows the underline to consist of a bunch of weirder things...
6060
if len(chars) != 1 or next(iter(chars)) not in "=-~_*+#":
6161
continue
62-
pos = pos + 2 # noqa: PLW2901
62+
pos += 2 # noqa: PLW2901
6363
break
6464
else:
6565
return

Diff for: tests/roots/test-resolve-typing-guard/demo_typing_guard.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
if TYPE_CHECKING:
1313
from decimal import Decimal
14-
from typing import Sequence
14+
from typing import Sequence # noqa: UP035
1515

1616
from demo_typing_guard_dummy import Literal # guarded by another `if TYPE_CHECKING` in demo_typing_guard_dummy
1717

0 commit comments

Comments
 (0)