Skip to content

Commit 8522396

Browse files
committed
Fix CI and add 3.13 as target with dep/tool upgrades
Signed-off-by: Bernát Gábor <[email protected]>
1 parent d0fa2bb commit 8522396

File tree

9 files changed

+58
-61
lines changed

9 files changed

+58
-61
lines changed

.github/workflows/check.yml

+7-15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
py:
23+
- "3.13"
2324
- "3.12"
2425
- "3.11"
2526
- "3.10"
@@ -38,20 +39,11 @@ jobs:
3839
uses: actions/setup-python@v5
3940
with:
4041
python-version: ${{ matrix.py }}
41-
- name: Pick environment to run
42-
run: |
43-
import os
44-
import sys
45-
from pathlib import Path
46-
env = "TOXENV=py{}{}\n".format(*sys.version_info[0:2])
47-
print("Picked:\n{}for{}".format(env, sys.version))
48-
with Path(os.environ["GITHUB_ENV"]).open("a") as file_handler:
49-
file_handler.write(env)
50-
shell: python
51-
- name: Setup test suite
52-
run: tox -vv --notest
53-
- name: Run test suite
54-
run: tox --skip-pkg-install
42+
allow-prereleases: true
43+
- name: setup test suite
44+
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }}
45+
- name: run test suite
46+
run: tox run --skip-pkg-install -e ${{ matrix.py }}
5547
env:
5648
PYTEST_ADDOPTS: "-vv --durations=20"
5749
CI_RUN: "yes"
@@ -118,7 +110,7 @@ jobs:
118110
with:
119111
python-version: "3.12"
120112
- name: Install tox
121-
run: python -m pip install tox
113+
run: python -m pip install tox-uv
122114
- name: Setup test suite
123115
run: tox -vv --notest -e ${{ matrix.tox_env }}
124116
- name: Run test suite

.pre-commit-config.yaml

+10-4
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,34 @@ repos:
88
rev: 0.29.2
99
hooks:
1010
- id: check-github-workflows
11-
args: [ "--verbose" ]
11+
args: ["--verbose"]
1212
- repo: https://github.com/codespell-project/codespell
1313
rev: v2.3.0
1414
hooks:
1515
- id: codespell
1616
additional_dependencies: ["tomli>=2.0.1"]
1717
- repo: https://github.com/tox-dev/tox-ini-fmt
18-
rev: "1.3.1"
18+
rev: "1.3.2"
1919
hooks:
2020
- id: tox-ini-fmt
2121
args: ["-p", "fix"]
2222
- repo: https://github.com/tox-dev/pyproject-fmt
2323
rev: "2.2.1"
2424
hooks:
2525
- id: pyproject-fmt
26-
additional_dependencies: ["tox>=4.14.2"]
2726
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: "v0.6.3"
27+
rev: "v0.6.4"
2928
hooks:
3029
- id: ruff-format
3130
- id: ruff
3231
args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
32+
- repo: https://github.com/rbubley/mirrors-prettier
33+
rev: "v3.3.3" # Use the sha / tag you want to point at
34+
hooks:
35+
- id: prettier
36+
additional_dependencies:
37+
38+
- "@prettier/[email protected]"
3339
- repo: meta
3440
hooks:
3541
- id: check-hooks-apply

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ The following configuration options are accepted:
6363
- `always_document_param_types` (default: `False`): If `False`, do not add type info for undocumented parameters. If
6464
`True`, add stub documentation for undocumented parameters to be able to add type info.
6565
- `always_use_bars_union ` (default: `False`): If `True`, display Union's using the | operator described in PEP 604.
66-
(e.g `X` | `Y` or `int` | `None`). If `False`, Unions will display with the typing in brackets. (e.g. `Union[X, Y]`
67-
or `Optional[int]`)
66+
(e.g `X` | `Y` or `int` | `None`). If `False`, Unions will display with the typing in brackets. (e.g. `Union[X, Y]`
67+
or `Optional[int]`)
6868
- `typehints_document_rtype` (default: `True`): If `False`, never add an `:rtype:` directive. If `True`, add the
6969
`:rtype:` directive if no existing `:rtype:` is found.
7070
- `typehints_use_rtype` (default: `True`): Controls behavior when `typehints_document_rtype` is set to `True`. If

pyproject.toml

+16-14
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.24",
5+
"hatchling>=1.25",
66
]
77

88
[project]
@@ -35,29 +35,30 @@ classifiers = [
3535
"Programming Language :: Python :: 3.10",
3636
"Programming Language :: Python :: 3.11",
3737
"Programming Language :: Python :: 3.12",
38+
"Programming Language :: Python :: 3.13",
3839
"Topic :: Documentation :: Sphinx",
3940
]
4041
dynamic = [
4142
"version",
4243
]
4344
dependencies = [
44-
"sphinx>=7.3.5",
45+
"sphinx>=8.0.2",
4546
]
4647
optional-dependencies.docs = [
47-
"furo>=2024.1.29",
48+
"furo>=2024.8.6",
4849
]
4950
optional-dependencies.numpy = [
5051
"nptyping>=2.5",
5152
]
5253
optional-dependencies.testing = [
5354
"covdefaults>=2.3",
54-
"coverage>=7.4.4",
55-
"defusedxml>=0.7.1", # required by sphinx.testing
56-
"diff-cover>=9",
57-
"pytest>=8.1.1",
55+
"coverage>=7.6.1",
56+
"defusedxml>=0.7.1", # required by sphinx.testing
57+
"diff-cover>=9.1.1",
58+
"pytest>=8.3.2",
5859
"pytest-cov>=5",
59-
"sphobjinv>=2.3.1",
60-
"typing-extensions>=4.11",
60+
"sphobjinv>=2.3.1.1",
61+
"typing-extensions>=4.12.2",
6162
]
6263
urls.Changelog = "https://github.com/tox-dev/sphinx-autodoc-typehints/blob/main/CHANGELOG.md"
6364
urls.Homepage = "https://github.com/tox-dev/sphinx-autodoc-typehints"
@@ -68,9 +69,6 @@ urls.Tracker = "https://github.com/tox-dev/sphinx-autodoc-typehints/issues"
6869
build.hooks.vcs.version-file = "src/sphinx_autodoc_typehints/version.py"
6970
version.source = "vcs"
7071

71-
[tool.black]
72-
line-length = 120
73-
7472
[tool.ruff]
7573
target-version = "py39"
7674
line-length = 120
@@ -87,18 +85,19 @@ lint.ignore = [
8785
"CPY", # No copyright statements
8886
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
8987
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
88+
"DOC", # no sphinx support
9089
"ISC001", # Conflict with formatter
9190
"S104", # Possible binding to all interface
9291
]
9392
lint.per-file-ignores."tests/**/*.py" = [
9493
"D", # don't care about documentation in tests
95-
"FBT", # don"t care about booleans as positional arguments in tests
94+
"FBT", # don't care about booleans as positional arguments in tests
9695
"INP001", # no implicit namespace
9796
"PLC2701", # private imports
9897
"PLR0913", # any number of arguments in tests
9998
"PLR0917", # any number of arguments in tests
10099
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
101-
"S101", # asserts allowed in tests...
100+
"S101", # asserts allowed in tests
102101
"S603", # `subprocess` call: check for execution of untrusted input
103102
]
104103
lint.isort = { known-first-party = [
@@ -115,6 +114,9 @@ ignore-words = "ignore-words.txt"
115114
write-changes = true
116115
count = true
117116

117+
[tool.pyproject-fmt]
118+
max_supported_python = "3.13"
119+
118120
[tool.pytest.ini_options]
119121
testpaths = [
120122
"tests",

src/sphinx_autodoc_typehints/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from sphinx.util.inspect import TypeAliasForwardRef, TypeAliasNamespace, stringify_signature
2121
from sphinx.util.inspect import signature as sphinx_signature
2222

23-
from .parser import parse
23+
from ._parser import parse
2424
from .patches import install_patches
2525
from .version import __version__
2626

File renamed without changes.

src/sphinx_autodoc_typehints/attributes_patch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from sphinx.domains.python import PyAttribute
1212
from sphinx.ext.autodoc import AttributeDocumenter
1313

14-
from .parser import parse
14+
from ._parser import parse
1515

1616
if TYPE_CHECKING:
1717
from docutils.frontend import Values

tests/roots/test-resolve-typing-guard/demo_typing_guard.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import typing
6-
from builtins import ValueError # handle does not have __module__
6+
from builtins import ValueError # handle does not have __module__ # noqa: A004
77
from functools import cmp_to_key # has __module__ but cannot get module as is builtin
88
from typing import TYPE_CHECKING
99

tox.ini

+20-23
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ requires =
33
tox>=4.2
44
env_list =
55
fix
6-
py312
7-
py311
8-
py310
9-
py39
106
type
117
coverage
128
readme
9+
3.12
10+
3.11
11+
3.10
12+
3.9
1313
skip_missing_interpreters = true
1414

1515
[testenv]
@@ -37,22 +37,15 @@ commands =
3737
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
3838
skip_install = true
3939
deps =
40-
pre-commit>=3.6.2
40+
pre-commit-uv>=4.1
4141
commands =
4242
pre-commit run --all-files --show-diff-on-failure
4343

44-
[testenv:py312]
45-
extras =
46-
testing
47-
type-comment
48-
4944
[testenv:type]
5045
description = run type check on code base
5146
deps =
52-
mypy==1.8
53-
types-docutils>=0.20.0.20240304
54-
set_env =
55-
{tty:MYPY_FORCE_COLOR = 1}
47+
mypy==1.11.2
48+
types-docutils>=0.21.0.20240907
5649
commands =
5750
mypy src
5851
mypy tests
@@ -62,8 +55,8 @@ description = combine coverage files and generate diff (against DIFF_AGAINST def
6255
skip_install = true
6356
deps =
6457
covdefaults>=2.3
65-
coverage>=7.4.3
66-
diff-cover>=8.0.3
58+
coverage>=7.6.1
59+
diff-cover>=9.1.1
6760
extras =
6861
parallel_show_output = true
6962
pass_env =
@@ -77,23 +70,27 @@ commands =
7770
coverage html -d {toxworkdir}/htmlcov
7871
diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml
7972
depends =
80-
py312
81-
py311
82-
py310
83-
py39
84-
py38
73+
3.12
74+
3.11
75+
3.10
76+
3.9
8577

8678
[testenv:readme]
8779
description = check that the long description is valid (need for PyPI)
8880
skip_install = true
8981
deps =
90-
build[virtualenv]>=1.1.1
91-
twine>=5
82+
build[virtualenv]>=1.2.2
83+
twine>=5.1.1
9284
extras =
9385
commands =
9486
pyproject-build -o {envtmpdir} --wheel --sdist .
9587
twine check {envtmpdir}/*
9688

89+
[testenv:3.13]
90+
extras =
91+
testing
92+
type-comment
93+
9794
[testenv:dev]
9895
description = generate a DEV environment
9996
package = editable

0 commit comments

Comments
 (0)