From 2282d050420e24a8c7966e42921beb266a70a8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Wed, 11 Nov 2026 15:14:05 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20build(lint):=20bump=20simplint?= =?UTF-8?q?=20to=200.10.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move tests of private code to matching package paths so the import checks can run without expanding the public API. Extend the release-creator cutoff exception because Nab checks the November 3 lock against its original seven-day window. --- .pre-commit-config.yaml | 2 +- pyproject.toml | 20 ++++++++++---------- src/pyproject_api/__main__.py | 2 +- src/pyproject_api/_via_fresh_subprocess.py | 2 +- tests/demo_pkg_inline/build.py | 4 ++-- tests/{ => pyproject_api}/test_backend.py | 8 +++----- tests/{ => pyproject_api}/test_util.py | 0 tests/test_frontend.py | 19 ++++++++++++++++--- tests/test_frontend_setuptools.py | 6 ++---- tests/test_main.py | 2 +- 10 files changed, 37 insertions(+), 28 deletions(-) rename tests/{ => pyproject_api}/test_backend.py (96%) rename tests/{ => pyproject_api}/test_util.py (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 90de1b1..95f2cb6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,7 +45,7 @@ repos: priority: 5 args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"] - repo: https://github.com/gaborbernat/simplint-pre-commit - rev: "f15525433ac9797aa1580f46fdadfe60dd77923c" # frozen: v0.8.0 + rev: "073bd9250c7a4d15b71eef71f2c95e4af5c76283" # frozen: v0.10.3 hooks: - id: simplint priority: 6 diff --git a/pyproject.toml b/pyproject.toml index 9be387f..9620e62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -132,16 +132,16 @@ lint.ignore = [ "DOC", # no restructuredtext support "hardcoded-bind-all-interfaces", # Possible binding to all interface "implicit-namespace-package", # no implicit namespaces here - "incorrect-blank-line-before-class", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible + "incorrect-blank-line-before-class", # Conflicts with `blank-line-before-class` "missing-trailing-comma", # Conflict with formatter - "multi-line-summary-first-line", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible + "multi-line-summary-first-line", # Conflicts with `multi-line-summary-second-line` "single-line-implicit-string-concatenation", # Conflict with formatter - "undocumented-magic-method", # undocumented-public-api (simplint SMP903) covers the public API instead - "undocumented-public-class", # undocumented-public-api (simplint SMP903) covers the public API instead - "undocumented-public-function", # undocumented-public-api (simplint SMP903) covers the public API instead - "undocumented-public-init", # undocumented-public-api (simplint SMP903) covers the public API instead - "undocumented-public-method", # undocumented-public-api (simplint SMP903) covers the public API instead - "undocumented-public-nested-class", # undocumented-public-api (simplint SMP903) covers the public API instead + "undocumented-magic-method", # undocumented-public-api (simplint) covers the public API instead + "undocumented-public-class", # undocumented-public-api (simplint) covers the public API instead + "undocumented-public-function", # undocumented-public-api (simplint) covers the public API instead + "undocumented-public-init", # undocumented-public-api (simplint) covers the public API instead + "undocumented-public-method", # undocumented-public-api (simplint) covers the public API instead + "undocumented-public-nested-class", # undocumented-public-api (simplint) covers the public API instead ] lint.per-file-ignores."src/pyproject_api/_backend.py" = [ "ANN", @@ -230,8 +230,8 @@ uploaded-prior-to = "P7D" decision-order = "stable" matrix.python = ">=3.15,<3.16" matrix.platforms = [ "linux_x86_64" ] -# release-creator 4.4.0 needs a seven-day cutoff exception. -# expires 2026-11-09 +# The 2026-11-03 lock still needs release-creator 4.4.0's cutoff exception. +# expires 2026-11-18 packages.release-creator.uploaded-prior-to = 2026-11-02T21:45:00Z # python-sbom 0.1.2 needs a seven-day cutoff exception. # expires 2026-11-15 diff --git a/src/pyproject_api/__main__.py b/src/pyproject_api/__main__.py index a8c5864..7d26cb5 100644 --- a/src/pyproject_api/__main__.py +++ b/src/pyproject_api/__main__.py @@ -92,7 +92,7 @@ def main(argv: list[str]) -> None: __all__ = [ "main", - "main_parser", # simplint: ignore[SMP402] # the CLI parser is public API, importable from this module + "main_parser", # simplint: ignore[unused-export] # the CLI parser is public API, importable from this module ] diff --git a/src/pyproject_api/_via_fresh_subprocess.py b/src/pyproject_api/_via_fresh_subprocess.py index 7d71a40..d5596a6 100644 --- a/src/pyproject_api/_via_fresh_subprocess.py +++ b/src/pyproject_api/_via_fresh_subprocess.py @@ -92,7 +92,7 @@ def _send_msg(self, cmd: str, result_file: Path, msg: str) -> Generator[Subproce def send_cmd( self, cmd: str, - **kwargs: Any, # simplint: ignore[SMP602] # send_cmd is a generic transport for any backend command + **kwargs: Any, # simplint: ignore[imprecise-annotation] # generic backend command transport ) -> tuple[JsonValue, str, str]: """ Send a command to the backend. diff --git a/tests/demo_pkg_inline/build.py b/tests/demo_pkg_inline/build.py index bbdaa88..974f5f1 100644 --- a/tests/demo_pkg_inline/build.py +++ b/tests/demo_pkg_inline/build.py @@ -102,8 +102,8 @@ def build_editable( def build_wheel( wheel_directory: str, - metadata_directory: str | None, - config_settings: dict[str, str] | None, # ruff:ignore[unused-function-argument] # the hook signature is fixed by PEP 517 + metadata_directory: str | None = None, + config_settings: dict[str, str] | None = None, # ruff:ignore[unused-function-argument] # the hook signature is fixed by PEP 517 ) -> str: base_name = f"{_NAME}-{_VERSION}-py{sys.version_info[0]}-none-any.whl" path = Path(wheel_directory) / base_name diff --git a/tests/test_backend.py b/tests/pyproject_api/test_backend.py similarity index 96% rename from tests/test_backend.py rename to tests/pyproject_api/test_backend.py index 236f610..6ffb5d5 100644 --- a/tests/test_backend.py +++ b/tests/pyproject_api/test_backend.py @@ -9,7 +9,7 @@ import pytest -from pyproject_api import SubprocessFrontend, _backend +from pyproject_api import SubprocessFrontend from pyproject_api._backend import BackendProxy, read_line, run if TYPE_CHECKING: @@ -17,8 +17,6 @@ import pytest_mock - from pyproject_api._frontend import JsonValue - def test_invalid_module(capsys: pytest.CaptureFixture[str]) -> None: with pytest.raises(ImportError): @@ -104,7 +102,7 @@ def test_reuse_process(mocker: pytest_mock.MockerFixture, capsys: pytest.Capture json.dumps({"cmd": "_exit", "kwargs": {}, "result": results[3]}), ] - def fake_backend(name: str, *args: JsonValue, **kwargs: JsonValue) -> JsonValue: # ruff:ignore[unused-function-argument] # the fake backend accepts any call + def fake_backend(name: str, **_kwargs: str) -> str: if name == "dummy_command_b": raise SystemExit(2) @@ -167,7 +165,7 @@ def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): json.dumps({**request, "result": str(path)}) for request, path in zip(requests, result_files, strict=True) ] completed = subprocess.run( - [sys.executable, _backend.__file__, "True", "exit_backend"], + [sys.executable, "-m", "pyproject_api._backend", "True", "exit_backend"], input="".join(f"{message}\n" for message in messages), capture_output=True, text=True, diff --git a/tests/test_util.py b/tests/pyproject_api/test_util.py similarity index 100% rename from tests/test_util.py rename to tests/pyproject_api/test_util.py diff --git a/tests/test_frontend.py b/tests/test_frontend.py index 665a767..09ab066 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -13,9 +13,11 @@ import pytest from packaging.requirements import Requirement -from pyproject_api import _via_fresh_subprocess -from pyproject_api._frontend import BackendFailed -from pyproject_api._via_fresh_subprocess import SubprocessFrontend +from pyproject_api import ( + BackendFailed, + SubprocessFrontend, + _via_fresh_subprocess, # simplint: ignore[private-import-path] # spy checks backend thread cleanup +) if TYPE_CHECKING: from collections.abc import Callable @@ -828,6 +830,17 @@ def test_backend_build_wheel(tmp_path: Path, demo_pkg_inline: Path) -> None: assert not result.err +def test_backend_build_wheel_with_only_directory(tmp_path: Path, demo_pkg_inline: Path) -> None: + frontend = SubprocessFrontend(*SubprocessFrontend.create_args_from_folder(demo_pkg_inline)[:-1]) + filename, _, err = frontend.send_cmd("build_wheel", wheel_directory=str(tmp_path)) + + assert (filename, (tmp_path / str(filename)).is_file(), err) == ( + "demo_pkg_inline-1.0.0-py3-none-any.whl", + True, + "", + ) + + def test_backend_build_editable_bad(tmp_path: Path, demo_pkg_inline: Path, monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setenv("BUILD_EDITABLE_BAD", "1") frontend = SubprocessFrontend(*SubprocessFrontend.create_args_from_folder(demo_pkg_inline)[:-1]) diff --git a/tests/test_frontend_setuptools.py b/tests/test_frontend_setuptools.py index 5b5b2ba..7b5dd5a 100644 --- a/tests/test_frontend_setuptools.py +++ b/tests/test_frontend_setuptools.py @@ -6,21 +6,19 @@ import pytest -from pyproject_api._frontend import BackendFailed -from pyproject_api._via_fresh_subprocess import SubprocessFrontend +from pyproject_api import BackendFailed, SubprocessFrontend if TYPE_CHECKING: from collections.abc import Generator from pathlib import Path - from _pytest.tmpdir import TempPathFactory from pytest_mock import MockerFixture from importlib.metadata import Distribution, EntryPoint @pytest.fixture(scope="session") -def frontend_setuptools(tmp_path_factory: TempPathFactory) -> SubprocessFrontend: +def frontend_setuptools(tmp_path_factory: pytest.TempPathFactory) -> SubprocessFrontend: prj = tmp_path_factory.mktemp("proj") (prj / "pyproject.toml").write_text( '[build-system]\nrequires=["setuptools","wheel"]\nbuild-backend = "setuptools.build_meta"', diff --git a/tests/test_main.py b/tests/test_main.py index f9d1c91..32de52d 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -7,7 +7,7 @@ import pytest import pyproject_api.__main__ -from pyproject_api._frontend import EditableResult, SdistResult, WheelResult +from pyproject_api import EditableResult, SdistResult, WheelResult if TYPE_CHECKING: import pytest_mock