From fc379eb78314d06e0f8342661fa12fb032b19ff1 Mon Sep 17 00:00:00 2001 From: Norwid Behrnd Date: Fri, 30 Oct 2026 14:08:55 +0100 Subject: [PATCH] feat(pyproject.py): check PP310, probe for pyproject-fmt For consistency across multiple Python project's supporting setup, a project should organize entries in file `pyproject.toml` with `pyproject-fmt`.[1] The addition addresses the corresponding discussion on GitHub.[2] [1] https://pypi.org/project/pyproject-fmt/ [2] https://github.com/scientific-python/cookie/issues/873 Assisted-by: mistral-ai, model mistral-medium-latest Signed-off-by: Norwid Behrnd --- src/sp_repo_review/checks/pyproject.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/sp_repo_review/checks/pyproject.py b/src/sp_repo_review/checks/pyproject.py index 0cd3f17b..4b275895 100644 --- a/src/sp_repo_review/checks/pyproject.py +++ b/src/sp_repo_review/checks/pyproject.py @@ -429,5 +429,29 @@ def check(pytest: tuple[PytestFile, dict[str, Any]]) -> bool: return "filterwarnings" in options +class PP310(PyProject): + "Project uses pyproject-fmt" + + url = mk_url("packaging-simple") + + @staticmethod + def check(pyproject: dict[str, Any]) -> bool: + """ + For consistency across multiple Python projects' supporting setup, + a project should organize entries in file `pyproject.toml` with + `pyproject-fmt`. A minimal working example is + + ```toml + [tool.pyproject-fmt] + max_supported_python = "3.14" + ``` + """ + match pyproject: + case {"tool": {"pyproject-fmt": {}}}: + return True + case _: + return False + + def repo_review_checks() -> dict[str, PyProject]: return {p.__name__: p() for p in PyProject.__subclasses__()}