From 9413e8bc2f5b53ec68c0a9a3926de805bea3a69d Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 20 Sep 2024 11:09:10 -0400 Subject: [PATCH] fix: add pixi support for PY007 Signed-off-by: Henry Schreiner --- README.md | 2 +- src/sp_repo_review/checks/general.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 05f91453..045ba03a 100644 --- a/README.md +++ b/README.md @@ -318,7 +318,7 @@ for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1 - [`PY004`](https://learn.scientific-python.org/development/guides/packaging-simple#PY004): Has docs folder - [`PY005`](https://learn.scientific-python.org/development/guides/packaging-simple#PY005): Has tests folder - [`PY006`](https://learn.scientific-python.org/development/guides/style#PY006): Has pre-commit config -- [`PY007`](https://learn.scientific-python.org/development/guides/tasks#PY007): Supports an easy task runner (nox or tox) +- [`PY007`](https://learn.scientific-python.org/development/guides/tasks#PY007): Supports an easy task runner (nox, tox, pixi, etc.) ### PyProject - [`PP002`](https://learn.scientific-python.org/development/guides/packaging-simple#PP002): Has a proper build-system table diff --git a/src/sp_repo_review/checks/general.py b/src/sp_repo_review/checks/general.py index 94112994..bcf377dd 100644 --- a/src/sp_repo_review/checks/general.py +++ b/src/sp_repo_review/checks/general.py @@ -104,7 +104,7 @@ def check(root: Traversable) -> bool: class PY007(General): - "Supports an easy task runner (nox or tox)" + "Supports an easy task runner (nox, tox, pixi, etc.)" url = mk_url("tasks") @@ -119,6 +119,8 @@ def check(root: Traversable, pyproject: dict[str, Any]) -> bool: return True if root.joinpath("tox.ini").is_file(): return True + if root.joinpath("pixi.toml").is_file(): + return True match pyproject.get("tool", {}): case {"hatch": {"envs": object()}}: return True @@ -126,6 +128,8 @@ def check(root: Traversable, pyproject: dict[str, Any]) -> bool: return True case {"tox": object()}: return True + case {"pixi": {"tasks": object()}}: + return True case _: return False