From de536ada07847b6b4deafe151654ec54140dedae Mon Sep 17 00:00:00 2001 From: Bill Wallis Date: Wed, 25 Mar 2026 17:38:58 +0000 Subject: [PATCH 1/2] test: refactor tests directory --- tests/python_template/__init__.py | 0 tests/python_template/test__main.py | 9 --------- tests/test__main.py | 5 +++++ 3 files changed, 5 insertions(+), 9 deletions(-) delete mode 100644 tests/python_template/__init__.py delete mode 100644 tests/python_template/test__main.py create mode 100644 tests/test__main.py diff --git a/tests/python_template/__init__.py b/tests/python_template/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/python_template/test__main.py b/tests/python_template/test__main.py deleted file mode 100644 index d7df1c7..0000000 --- a/tests/python_template/test__main.py +++ /dev/null @@ -1,9 +0,0 @@ -from python_template import main - - -def test__main_can_be_called(): - """ - The entry point can be called without error. - """ - - main.main() diff --git a/tests/test__main.py b/tests/test__main.py new file mode 100644 index 0000000..32da236 --- /dev/null +++ b/tests/test__main.py @@ -0,0 +1,5 @@ +from python_template import main + + +def test__main__happy_path(): + assert main.main() == 0 From 334be0d638d54318e099c1425e3f5fe2c9c55a7c Mon Sep 17 00:00:00 2001 From: Bill Wallis Date: Wed, 25 Mar 2026 18:01:57 +0000 Subject: [PATCH 2/2] chore: refine pre-commit hooks --- .pre-commit-config.yaml | 52 ++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b32b115..c1157a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ --- ci: autoupdate_schedule: quarterly - skip: ["identity", "uv-lock", "ty", "pytest", "coverage-badge"] + skip: ["identity", "uv-lock", "pytest", "coverage-badge"] default_install_hook_types: ["pre-commit", "pre-push"] default_stages: ["pre-commit"] @@ -16,64 +16,40 @@ repos: rev: v6.0.0 hooks: - id: no-commit-to-branch - name: Don't allow commits to the main branch args: ["--branch", "main"] - id: trailing-whitespace - name: Remove trailing whitespace - id: end-of-file-fixer - name: Ensure files end with a newline character exclude: "coverage.svg" - id: mixed-line-ending - name: Align mixed line ending - id: check-added-large-files - name: Check for large files - id: check-json - name: Check JSON files are valid and parseable exclude: "devcontainer.json" - id: check-yaml - name: Check YAML files are valid and parseable - id: check-toml - name: Check TOML files are valid and parseable - id: check-ast - name: Validate Python - id: detect-private-key - name: Check for the existence of private keys - repo: https://github.com/pre-commit-ci/pre-commit-ci-config rev: v1.6.1 hooks: - id: check-pre-commit-ci-config - name: Validate pre-commit CI config - repo: https://github.com/astral-sh/uv-pre-commit - rev: 0.10.12 + rev: 0.11.1 hooks: - id: uv-lock - name: Check that the lock file is up-to-date - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.15.7 hooks: - id: ruff-check - name: Lint Python code args: ["--fix"] - id: ruff-format - name: Format Python code - - # https://github.com/astral-sh/ty?tab=readme-ov-file#getting-started - - repo: local - hooks: - - id: ty - name: Run type checks - entry: uvx ty check - language: system - pass_filenames: true - always_run: false - types: ["python"] - repo: https://github.com/billwallis/bills-hooks - rev: v0.0.10 + rev: v0.0.13 hooks: + - id: banned-python-code - id: check-no-commit-comment - id: tidy-gitkeep @@ -85,16 +61,22 @@ repos: - repo: local hooks: - - id: check-pyproject-schema + - <<: &check-jsonschema-config + entry: check-jsonschema + pass_filenames: true + language: python + additional_dependencies: ["check-jsonschema==0.37.0"] + # This calls a remote URL, so run on pre-push to avoid slowing down commits + stages: ["pre-push"] + id: check-pyproject-schema name: Validate pyproject.toml schema - entry: check-jsonschema - pass_filenames: true - language: python - additional_dependencies: ["check-jsonschema==0.37.0"] files: pyproject.toml args: ["--schemafile", "https://json.schemastore.org/pyproject.json"] - # This calls a remote URL, so run on pre-push to avoid slowing down commits - stages: ["pre-push"] + - <<: *check-jsonschema-config + id: check-pre-commit-hooks-schema + name: Validate .pre-commit-hooks.yaml schema + files: .pre-commit-hooks.yaml + args: ["--schemafile", "https://json.schemastore.org/pre-commit-hooks.json"] - repo: local hooks: