From ecc71ea77e2c9c620f5c6e048294dbc3a8ce0bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Mon, 9 Feb 2026 16:11:30 +0100 Subject: [PATCH 1/2] ENH: allow tox.toml in rule `PY007` --- src/sp_repo_review/checks/general.py | 11 +++++------ tests/test_general.py | 3 ++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sp_repo_review/checks/general.py b/src/sp_repo_review/checks/general.py index 08e12058..482ffc57 100644 --- a/src/sp_repo_review/checks/general.py +++ b/src/sp_repo_review/checks/general.py @@ -123,6 +123,9 @@ def check(root: Traversable) -> bool: return root.joinpath(".pre-commit-config.yaml").is_file() +PY007_VALID_RUNNER_CONFS = frozenset(["noxfile.py", "tox.ini", "tox.toml", "pixi.toml"]) + + class PY007(General): "Supports an easy task runner (nox, tox, pixi, etc.)" @@ -131,15 +134,11 @@ class PY007(General): @staticmethod def check(root: Traversable, pyproject: dict[str, Any]) -> bool: """ - Projects must have a `noxfile.py`, `tox.ini`, or + Projects must have a `noxfile.py`, `tox.ini`, `tox.toml`, `pixi.toml` or `tool.hatch.envs`/`tool.spin`/`tool.tox` in `pyproject.toml` to encourage new contributors. """ - if root.joinpath("noxfile.py").is_file(): - return True - if root.joinpath("tox.ini").is_file(): - return True - if root.joinpath("pixi.toml").is_file(): + if any(root.joinpath(fn).is_file for fn in PY007_VALID_RUNNER_CONFS): return True match pyproject.get("tool", {}): case {"hatch": {"envs": object()}}: diff --git a/tests/test_general.py b/tests/test_general.py index ec67b645..3699944b 100644 --- a/tests/test_general.py +++ b/tests/test_general.py @@ -4,6 +4,7 @@ from repo_review.testing import compute_check from sp_repo_review._compat import tomllib +from sp_repo_review.checks.general import PY007_VALID_RUNNER_CONFS def test_py001(tmp_path: Path): @@ -140,7 +141,7 @@ def test_py006_missing(tmp_path: Path): assert not compute_check("PY006", root=simple).result -@pytest.mark.parametrize("runnerfile", ["noxfile.py", "tox.ini", "pixi.toml"]) +@pytest.mark.parametrize("runnerfile", PY007_VALID_RUNNER_CONFS) def test_py007(tmp_path: Path, runnerfile: str): simple = tmp_path / "simple" simple.mkdir() From 6330df5d0871d8da205798fd4359e74359b52070 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 9 Feb 2026 23:45:55 -0500 Subject: [PATCH 2/2] Apply suggestions from code review --- src/sp_repo_review/checks/general.py | 2 +- tests/test_general.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sp_repo_review/checks/general.py b/src/sp_repo_review/checks/general.py index 482ffc57..7a23696c 100644 --- a/src/sp_repo_review/checks/general.py +++ b/src/sp_repo_review/checks/general.py @@ -138,7 +138,7 @@ def check(root: Traversable, pyproject: dict[str, Any]) -> bool: `tool.hatch.envs`/`tool.spin`/`tool.tox` in `pyproject.toml` to encourage new contributors. """ - if any(root.joinpath(fn).is_file for fn in PY007_VALID_RUNNER_CONFS): + if any(root.joinpath(fn).is_file() for fn in PY007_VALID_RUNNER_CONFS): return True match pyproject.get("tool", {}): case {"hatch": {"envs": object()}}: diff --git a/tests/test_general.py b/tests/test_general.py index 3699944b..634c0f4f 100644 --- a/tests/test_general.py +++ b/tests/test_general.py @@ -141,7 +141,7 @@ def test_py006_missing(tmp_path: Path): assert not compute_check("PY006", root=simple).result -@pytest.mark.parametrize("runnerfile", PY007_VALID_RUNNER_CONFS) +@pytest.mark.parametrize("runnerfile", sorted(PY007_VALID_RUNNER_CONFS)) def test_py007(tmp_path: Path, runnerfile: str): simple = tmp_path / "simple" simple.mkdir()