From 45d3a95e04bf4d14daca4aecca3ae09eac3df929 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Tue, 30 Dec 2025 15:14:41 +0100 Subject: [PATCH 1/2] Add ty overrides for version module --- pyproject.toml | 13 +++++++++++++ src/pytask_stata/__init__.py | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 923bc5f..3477acd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,6 +79,19 @@ force-single-line = true [tool.ruff.lint.pydocstyle] convention = "numpy" +[tool.ty.rules] +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.pytest.ini_options] # Do not add src since it messes with the loading of pytask-parallel as a plugin. testpaths = ["tests"] diff --git a/src/pytask_stata/__init__.py b/src/pytask_stata/__init__.py index f493641..b5188d1 100644 --- a/src/pytask_stata/__init__.py +++ b/src/pytask_stata/__init__.py @@ -1,7 +1,9 @@ from __future__ import annotations try: - from ._version import version as __version__ + from ._version import ( + version as __version__, # ty: ignore[unresolved-import, unused-ignore-comment] + ) except ImportError: # broken installation, we don't even try unknown only works because we do poor mans # version compare From 2a03e4e5512df3165a64bbc40802b5c49274f71f Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Tue, 30 Dec 2025 15:30:46 +0100 Subject: [PATCH 2/2] Fix ty ignores --- pyproject.toml | 6 ++++++ src/pytask_stata/__init__.py | 4 +--- tests/test_execute.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3477acd..c76d686 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,6 +91,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.pytest.ini_options] # Do not add src since it messes with the loading of pytask-parallel as a plugin. diff --git a/src/pytask_stata/__init__.py b/src/pytask_stata/__init__.py index b5188d1..111661a 100644 --- a/src/pytask_stata/__init__.py +++ b/src/pytask_stata/__init__.py @@ -1,9 +1,7 @@ from __future__ import annotations 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: # broken installation, we don't even try unknown only works because we do poor mans # version compare diff --git a/tests/test_execute.py b/tests/test_execute.py index 73a1668..1107876 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -30,7 +30,7 @@ def test_pytask_execute_task_setup_raise_error(stata, platform, expectation): task = Task( base_name="task_example", path=Path(), - function=lambda: None, # ty: ignore[invalid-argument-type] + function=lambda: None, markers=[Mark("stata", (), {})], )