From 1eb74003b22288756f264dbaf02e665c44ab55bd Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Wed, 5 Aug 2026 18:18:37 +0100 Subject: [PATCH 1/3] Add no-defaults linting --- .pre-commit-config.yaml | 6 ++++++ pyproject.toml | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b2441e7b..662d831d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -415,3 +415,9 @@ repos: types_or: [markdown, rst] additional_dependencies: - *uv_version + + - repo: https://github.com/adamtheturtle/no-defaults + rev: v1.0.0 + hooks: + - id: no-defaults + stages: [pre-commit] diff --git a/pyproject.toml b/pyproject.toml index 14a1192f..79716d3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -151,6 +151,7 @@ lint.per-file-ignores."tests/*.py" = [ lint.unfixable = [ "ERA001", ] +lint.external = [ "NOD" ] lint.flake8-tidy-imports.banned-api."typing.cast".msg = "typing.cast is banned: use explicit type narrowing or a typed variable instead." lint.pydocstyle.convention = "google" @@ -438,3 +439,7 @@ ignore_path = [ [tool.yamlfix] section_whitelines = 1 whitelines = 1 + +[tool.no_defaults] +private_only = true +per_file_enforcement."tests/**" = "all" From 01af8b4f038dd835cd430a47ab6cc2e9ebfdfd14 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Wed, 5 Aug 2026 23:14:43 +0100 Subject: [PATCH 2/3] Bump no-defaults to v1.0.1 Picks up the fix for annotated locals in dataclass methods being misreported as fields (adamtheturtle/no-defaults#6). Co-Authored-By: Claude Opus 5 (1M context) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 662d831d..e2837cfe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -417,7 +417,7 @@ repos: - *uv_version - repo: https://github.com/adamtheturtle/no-defaults - rev: v1.0.0 + rev: v1.0.1 hooks: - id: no-defaults stages: [pre-commit] From 4c3d1eb67e19e3d92bab2841ac9b0066b8994f63 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Thu, 6 Aug 2026 05:31:58 +0100 Subject: [PATCH 3/3] Run no-defaults as a local uv hook Run no-defaults as a local uv hook instead of the upstream pre-commit hook, matching the other locally-defined hooks. The pin moves to the dev extra in pyproject.toml, and the hook joins the pre-commit.ci skip list alongside the other hooks that need project dependencies. Co-Authored-By: Claude Opus 5 (1M context) --- .pre-commit-config.yaml | 16 ++++++++++------ pyproject.toml | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e2837cfe..0cd0ac39 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -269,6 +269,16 @@ repos: stages: [pre-commit] require_serial: true + - id: no-defaults + name: no-defaults + entry: uv run --extra=dev no-defaults + language: python + types_or: [python] + additional_dependencies: + - *uv_version + stages: [pre-commit] + require_serial: true + - id: doc8 name: doc8 entry: uv run --extra=dev -m doc8 @@ -415,9 +425,3 @@ repos: types_or: [markdown, rst] additional_dependencies: - *uv_version - - - repo: https://github.com/adamtheturtle/no-defaults - rev: v1.0.1 - hooks: - - id: no-defaults - stages: [pre-commit] diff --git a/pyproject.toml b/pyproject.toml index 79716d3a..0410a509 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ optional-dependencies.dev = [ "interrogate==1.7.0", "mypy[faster-cache]==2.3.0", "mypy-strict-kwargs==2026.7.19.1", + "no-defaults==1.0.1", "prek==0.4.11", "pydocstringformatter==1.0.0", "pydocstyle==6.3",