From ee32c8fef3d8235102000ab6e87f1c4e456817d4 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Tue, 30 Dec 2025 15:15:26 +0100 Subject: [PATCH 1/2] Add ty overrides for version module --- {{cookiecutter.project_slug}}/pyproject.toml | 7 +++++++ .../src/{{cookiecutter.project_slug}}/__init__.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 1e95f19..df1ca87 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -93,6 +93,13 @@ unused-ignore-comment = "error" [tool.ty.terminal] error-on-warning = true +[[tool.ty.overrides]] +include = ["src/**/_version.py"] + +[tool.ty.overrides.rules] +invalid-type-form = "ignore" + + [tool.pytask.ini_options] paths = ["src/{{ cookiecutter.project_slug }}"] diff --git a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py index 75190c8..db8fac0 100644 --- a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py +++ b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py @@ -4,7 +4,7 @@ # when the project is installed with ``pip install -e .``. Do not put it into version # control! try: - from ._version import version as __version__ # ty: ignore[unresolved-import] + from ._version import version as __version__ # ty: ignore[unresolved-import, unused-ignore-comment] except ImportError: __version__ = "unknown" From 0422ef85b0e278be18acffb3c58f85ab3a8833ec Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Tue, 30 Dec 2025 15:31:12 +0100 Subject: [PATCH 2/2] Fix ty ignores --- {{cookiecutter.project_slug}}/pyproject.toml | 6 ++++++ .../src/{{cookiecutter.project_slug}}/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index df1ca87..f592fc4 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -99,6 +99,12 @@ include = ["src/**/_version.py"] [tool.ty.overrides.rules] invalid-type-form = "ignore" +[[tool.ty.overrides]] +include = ["src/**/__init__.py"] + +[tool.ty.overrides.rules] +unused-ignore-comment = "ignore" + [tool.pytask.ini_options] paths = ["src/{{ cookiecutter.project_slug }}"] diff --git a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py index db8fac0..75190c8 100644 --- a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py +++ b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py @@ -4,7 +4,7 @@ # when the project is installed with ``pip install -e .``. Do not put it into version # control! try: - from ._version import version as __version__ # ty: ignore[unresolved-import, unused-ignore-comment] + from ._version import version as __version__ # ty: ignore[unresolved-import] except ImportError: __version__ = "unknown"