Skip to content

Commit 136e5de

Browse files
[pre-commit.ci] pre-commit autoupdate (#174)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/python-jsonschema/check-jsonschema: 0.29.4 → 0.31.0](python-jsonschema/check-jsonschema@0.29.4...0.31.0) - [github.com/astral-sh/ruff-pre-commit: v0.8.0 → v0.9.2](astral-sh/ruff-pre-commit@v0.8.0...v0.9.2) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Signed-off-by: Bernát Gábor <[email protected]> --------- Signed-off-by: Bernát Gábor <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 81e9d22 commit 136e5de

File tree

10 files changed

+70
-36
lines changed

10 files changed

+70
-36
lines changed

.github/workflows/check.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
- "3.11"
2626
- "3.10"
2727
- "3.9"
28-
- "3.8"
2928
- type
3029
- dev
3130
- pkg_meta

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ repos:
55
- id: end-of-file-fixer
66
- id: trailing-whitespace
77
- repo: https://github.com/python-jsonschema/check-jsonschema
8-
rev: 0.29.4
8+
rev: 0.31.0
99
hooks:
1010
- id: check-github-workflows
1111
args: [ "--verbose" ]
1212
- repo: https://github.com/codespell-project/codespell
1313
rev: v2.3.0
1414
hooks:
1515
- id: codespell
16-
additional_dependencies: ["tomli>=2.0.1"]
16+
additional_dependencies: ["tomli>=2.2.1"]
1717
- repo: https://github.com/tox-dev/tox-ini-fmt
1818
rev: "1.4.1"
1919
hooks:
@@ -24,7 +24,7 @@ repos:
2424
hooks:
2525
- id: pyproject-fmt
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: "v0.8.0"
27+
rev: "v0.9.2"
2828
hooks:
2929
- id: ruff-format
3030
- id: ruff

docs/conf.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# noqa: D100
22
from __future__ import annotations
33

4+
from typing import TYPE_CHECKING
5+
6+
from sphinx.domains.python import PythonDomain
7+
48
from pyproject_api import __version__
59

10+
if TYPE_CHECKING:
11+
from docutils.nodes import Element
12+
from sphinx.application import Sphinx
13+
from sphinx.builders import Builder
14+
from sphinx.environment import BuildEnvironment
615
project = name = "pyproject_api"
716
company = "tox-dev"
8-
copyright = f"{company}" # noqa: A001
17+
project_copyright = f"{company}"
918
version, release = __version__, __version__.split("+")[0]
1019

1120
extensions = [
@@ -38,3 +47,26 @@
3847

3948
nitpicky = True
4049
nitpick_ignore = []
50+
51+
52+
def setup(app: Sphinx) -> None: # noqa: D103
53+
class PatchedPythonDomain(PythonDomain):
54+
def resolve_xref( # noqa: PLR0913,PLR0917
55+
self,
56+
env: BuildEnvironment,
57+
fromdocname: str,
58+
builder: Builder,
59+
type: str, # noqa: A002
60+
target: str,
61+
node: resolve_xref,
62+
contnode: Element,
63+
) -> Element:
64+
# fixup some wrongly resolved mappings
65+
mapping = {
66+
"pathlib._local.Path": "pathlib.Path",
67+
}
68+
if target in mapping:
69+
target = node["reftarget"] = mapping[target]
70+
return super().resolve_xref(env, fromdocname, builder, type, target, node, contnode)
71+
72+
app.add_domain(PatchedPythonDomain, override=True)

pyproject.toml

Lines changed: 8 additions & 10 deletions
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.25",
5+
"hatchling>=1.27",
66
]
77

88
[project]
@@ -23,7 +23,7 @@ maintainers = [
2323
authors = [
2424
{ name = "Bernát Gábor", email = "[email protected]" },
2525
]
26-
requires-python = ">=3.8"
26+
requires-python = ">=3.9"
2727
classifiers = [
2828
"Development Status :: 5 - Production/Stable",
2929
"Framework :: tox",
@@ -33,7 +33,6 @@ classifiers = [
3333
"Operating System :: Microsoft :: Windows",
3434
"Operating System :: POSIX",
3535
"Programming Language :: Python :: 3 :: Only",
36-
"Programming Language :: Python :: 3.8",
3736
"Programming Language :: Python :: 3.9",
3837
"Programming Language :: Python :: 3.10",
3938
"Programming Language :: Python :: 3.11",
@@ -47,19 +46,19 @@ dynamic = [
4746
"version",
4847
]
4948
dependencies = [
50-
"packaging>=24.1",
51-
"tomli>=2.0.1; python_version<'3.11'",
49+
"packaging>=24.2",
50+
"tomli>=2.2.1; python_version<'3.11'",
5251
]
5352
optional-dependencies.docs = [
5453
"furo>=2024.8.6",
55-
"sphinx-autodoc-typehints>=2.4.1",
54+
"sphinx-autodoc-typehints>=3",
5655
]
5756
optional-dependencies.testing = [
5857
"covdefaults>=2.3",
59-
"pytest>=8.3.3",
60-
"pytest-cov>=5",
58+
"pytest>=8.3.4",
59+
"pytest-cov>=6",
6160
"pytest-mock>=3.14",
62-
"setuptools>=75.1",
61+
"setuptools>=75.8",
6362
]
6463
urls.Changelog = "https://github.com/tox-dev/pyproject-api/releases"
6564
urls.Homepage = "https://pyproject-api.readthedocs.io"
@@ -71,7 +70,6 @@ build.hooks.vcs.version-file = "src/pyproject_api/_version.py"
7170
version.source = "vcs"
7271

7372
[tool.ruff]
74-
target-version = "py38"
7573
line-length = 120
7674
format.preview = true
7775
format.docstring-code-line-length = 100

src/pyproject_api/_backend.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Sequence
1+
from collections.abc import Sequence
2+
from typing import Any
23

34
class MissingCommand(TypeError): ... # noqa: N818
45

src/pyproject_api/_frontend.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,23 @@
99
from pathlib import Path
1010
from tempfile import NamedTemporaryFile, TemporaryDirectory
1111
from time import sleep
12-
from typing import Any, Dict, Iterator, List, Literal, NamedTuple, NoReturn, Optional, TypedDict, cast
12+
from typing import TYPE_CHECKING, Any, Literal, NamedTuple, NoReturn, Optional, TypedDict, cast
1313
from zipfile import ZipFile
1414

1515
from packaging.requirements import Requirement
1616

1717
from pyproject_api._util import ensure_empty_dir
1818

19+
if TYPE_CHECKING:
20+
from collections.abc import Iterator
21+
1922
if sys.version_info >= (3, 11): # pragma: no cover (py311+)
2023
import tomllib
2124
else: # pragma: no cover (py311+)
2225
import tomli as tomllib
2326

2427
_HERE = Path(__file__).parent
25-
ConfigSettings = Optional[Dict[str, Any]]
28+
ConfigSettings = Optional[dict[str, Any]]
2629

2730

2831
class OptionalHooks(TypedDict, total=True):
@@ -276,7 +279,7 @@ def get_requires_for_build_sdist(self, config_settings: ConfigSettings | None =
276279
result, out, err = [], "", ""
277280
if not isinstance(result, list) or not all(isinstance(i, str) for i in result):
278281
self._unexpected_response("get_requires_for_build_sdist", result, "list of string", out, err)
279-
return RequiresBuildSdistResult(tuple(Requirement(r) for r in cast(List[str], result)), out, err)
282+
return RequiresBuildSdistResult(tuple(Requirement(r) for r in cast("list[str]", result)), out, err)
280283

281284
def get_requires_for_build_wheel(self, config_settings: ConfigSettings | None = None) -> RequiresBuildWheelResult:
282285
"""
@@ -291,7 +294,7 @@ def get_requires_for_build_wheel(self, config_settings: ConfigSettings | None =
291294
result, out, err = [], "", ""
292295
if not isinstance(result, list) or not all(isinstance(i, str) for i in result):
293296
self._unexpected_response("get_requires_for_build_wheel", result, "list of string", out, err)
294-
return RequiresBuildWheelResult(tuple(Requirement(r) for r in cast(List[str], result)), out, err)
297+
return RequiresBuildWheelResult(tuple(Requirement(r) for r in cast("list[str]", result)), out, err)
295298

296299
def get_requires_for_build_editable(
297300
self,
@@ -309,7 +312,7 @@ def get_requires_for_build_editable(
309312
result, out, err = [], "", ""
310313
if not isinstance(result, list) or not all(isinstance(i, str) for i in result):
311314
self._unexpected_response("get_requires_for_build_editable", result, "list of string", out, err)
312-
return RequiresBuildEditableResult(tuple(Requirement(r) for r in cast(List[str], result)), out, err)
315+
return RequiresBuildEditableResult(tuple(Requirement(r) for r in cast("list[str]", result)), out, err)
313316

314317
def prepare_metadata_for_build_wheel(
315318
self,

src/pyproject_api/_via_fresh_subprocess.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
from contextlib import contextmanager
66
from subprocess import PIPE, Popen # noqa: S404
77
from threading import Thread
8-
from typing import IO, TYPE_CHECKING, Any, Iterator, Tuple, cast
8+
from typing import IO, TYPE_CHECKING, Any, cast
99

1010
from ._frontend import CmdStatus, Frontend
1111

1212
if TYPE_CHECKING:
13+
from collections.abc import Iterator
1314
from pathlib import Path
1415

1516
from packaging.requirements import Requirement
@@ -30,7 +31,7 @@ def done(self) -> bool:
3031
return self.process.returncode is not None
3132

3233
def out_err(self) -> tuple[str, str]:
33-
return cast(Tuple[str, str], self._out_err)
34+
return cast("tuple[str, str]", self._out_err)
3435

3536

3637
class SubprocessFrontend(Frontend):
@@ -71,7 +72,7 @@ def _send_msg(self, cmd: str, result_file: Path, msg: str) -> Iterator[Subproces
7172
cwd=self._root,
7273
env=env,
7374
)
74-
cast(IO[str], process.stdin).write(f"{os.linesep}{msg}{os.linesep}")
75+
cast("IO[str]", process.stdin).write(f"{os.linesep}{msg}{os.linesep}")
7576
yield SubprocessCmdStatus(process)
7677

7778
def send_cmd(self, cmd: str, **kwargs: Any) -> tuple[Any, str, str]:

tests/test_frontend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def test_no_wheel_prepare_metadata_for_build_wheel(local_builder: Callable[[str]
177177
tmp_path = local_builder(txt)
178178
frontend = SubprocessFrontend(*SubprocessFrontend.create_args_from_folder(tmp_path)[:-1])
179179

180-
with pytest.raises(RuntimeError, match="missing wheel file return by backed *"):
180+
with pytest.raises(RuntimeError, match=r"missing wheel file return by backed *"):
181181
frontend.metadata_from_built(tmp_path, "wheel")
182182

183183

@@ -213,7 +213,7 @@ def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
213213
tmp_path = local_builder(txt)
214214
frontend = SubprocessFrontend(*SubprocessFrontend.create_args_from_folder(tmp_path)[:-1])
215215

216-
with pytest.raises(RuntimeError, match="no .dist-info found inside generated wheel*"):
216+
with pytest.raises(RuntimeError, match=r"no .dist-info found inside generated wheel*"):
217217
frontend.metadata_from_built(tmp_path, "wheel")
218218

219219

tests/test_frontend_setuptools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import sys
44
from contextlib import contextmanager
55
from stat import S_IWGRP, S_IWOTH, S_IWUSR
6-
from typing import TYPE_CHECKING, Iterator, NamedTuple
6+
from typing import TYPE_CHECKING, NamedTuple
77

88
import pytest
99

1010
from pyproject_api._frontend import BackendFailed
1111
from pyproject_api._via_fresh_subprocess import SubprocessFrontend
1212

1313
if TYPE_CHECKING:
14+
from collections.abc import Iterator
1415
from pathlib import Path
1516

1617
from _pytest.tmpdir import TempPathFactory

tox.ini

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
[tox]
22
requires =
3-
tox>=4.2
4-
tox-uv>=1.11
3+
tox>=4.23.2
4+
tox-uv>=1.17
55
env_list =
66
fix
77
3.13
88
3.12
99
3.11
1010
3.10
1111
3.9
12-
3.8
1312
docs
1413
type
1514
pkg_meta
@@ -40,7 +39,7 @@ commands =
4039
description = run static analysis and style check using flake8
4140
package = skip
4241
deps =
43-
pre-commit-uv>=4.1.1
42+
pre-commit-uv>=4.1.4
4443
pass_env =
4544
HOMEPATH
4645
PROGRAMDATA
@@ -53,13 +52,13 @@ description = build documentation
5352
extras =
5453
docs
5554
commands =
56-
sphinx-build -d "{env_tmp_dir}{/}doc_tree" docs "{work_dir}{/}docs_out" --color -b html {posargs} -W
55+
sphinx-build -d "{env_tmp_dir}{/}doc_tree" docs "{work_dir}{/}docs_out" --color -b html {posargs: -W}
5756
python -c 'print(r"documentation available under file://{work_dir}{/}docs_out{/}index.html")'
5857

5958
[testenv:type]
6059
description = run type check on code base
6160
deps =
62-
mypy==1.11.2
61+
mypy==1.14.1
6362
set_env =
6463
{tty:MYPY_FORCE_COLOR = 1}
6564
commands =
@@ -70,9 +69,9 @@ commands =
7069
description = check that the long description is valid
7170
skip_install = true
7271
deps =
73-
check-wheel-contents>=0.6
74-
twine>=5.1.1
75-
uv>=0.4.10
72+
check-wheel-contents>=0.6.1
73+
twine>=6.0.1
74+
uv>=0.5.18
7675
commands =
7776
uv build --sdist --wheel --out-dir {env_tmp_dir} .
7877
twine check {env_tmp_dir}{/}*

0 commit comments

Comments
 (0)