From a9ecdd2fda04101f706c81ac8304bbf9796a4c55 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Wed, 31 Dec 2025 11:53:06 +0100 Subject: [PATCH 1/7] chore: update install docs and typing fixes --- README.md | 4 ++-- justfile | 2 +- src/pytask_stata/collect.py | 6 +++--- src/pytask_stata/execute.py | 8 ++++++-- tests/test_collect.py | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 81eca38..a108197 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,11 @@ pytask-stata is available on [PyPI](https://pypi.org/project/pytask-stata) and [Anaconda.org](https://anaconda.org/conda-forge/pytask-stata). Install it with ```console -$ pip install pytask-stata +$ uv add pytask-stata # or -$ conda install -c conda-forge pytask-stata +$ pixi add pytask-stata ``` You also need to have Stata installed on your system and have the executable on your diff --git a/justfile b/justfile index a32c271..4ea0144 100644 --- a/justfile +++ b/justfile @@ -8,7 +8,7 @@ test: # Run type checking typing: - uv run --group typing --group test ty check + uv run --group typing --group test --isolated ty check # Run linting and formatting lint: diff --git a/src/pytask_stata/collect.py b/src/pytask_stata/collect.py index 529608b..de12e14 100644 --- a/src/pytask_stata/collect.py +++ b/src/pytask_stata/collect.py @@ -62,8 +62,8 @@ def pytask_collect_task( raise ValueError(msg) mark = _parse_stata_mark(mark=marks[0]) - script, options = stata(**marks[0].kwargs) # ty: ignore[missing-argument] - obj.pytask_meta.markers.append(mark) # ty: ignore[possibly-unbound-attribute] + script, options = stata(**marks[0].kwargs) + obj.pytask_meta.markers.append(mark) # ty: ignore[possibly-missing-attribute] # Collect the nodes in @pytask.mark.julia and validate them. path_nodes = Path.cwd() if path is None else path.parent @@ -187,6 +187,6 @@ def pytask_collect_task( def _parse_stata_mark(mark: Mark) -> Mark: """Parse a Stata mark.""" - script, options = stata(**mark.kwargs) # ty: ignore[missing-argument] + script, options = stata(**mark.kwargs) parsed_kwargs = {"script": script or None, "options": options or []} return Mark("stata", (), parsed_kwargs) diff --git a/src/pytask_stata/execute.py b/src/pytask_stata/execute.py index e7d2b1f..07b4925 100644 --- a/src/pytask_stata/execute.py +++ b/src/pytask_stata/execute.py @@ -4,9 +4,12 @@ import re from pathlib import Path +from typing import cast +from pytask import PathNode from pytask import PTask from pytask import PTaskWithPath +from pytask import PythonNode from pytask import Session from pytask import has_mark from pytask import hookimpl @@ -40,14 +43,15 @@ def pytask_execute_task_teardown(session: Session, task: PTask) -> None: """ if has_mark(task, "stata"): if session.config["platform"] == "win32": - log_name = task.depends_on["_log_name"].load() # ty: ignore[call-non-callable] + log_name_node = task.depends_on["_log_name"] + log_name = cast("PythonNode", log_name_node).load() if isinstance(task, PTaskWithPath): path_to_log = task.path.with_name(log_name).with_suffix(".log") else: path_to_log = Path.cwd() / f"{log_name}.log" else: node = task.depends_on["_script"] - path_to_log = node.path.with_suffix(".log") # ty: ignore[call-non-callable,possibly-unbound-attribute] + path_to_log = cast("PathNode", node).path.with_suffix(".log") n_lines = session.config["stata_check_log_lines"] diff --git a/tests/test_collect.py b/tests/test_collect.py index 04b1ff8..4a7ca3b 100644 --- a/tests/test_collect.py +++ b/tests/test_collect.py @@ -28,7 +28,7 @@ ) def test_stata(args, kwargs, expectation, expected): with expectation: - options = stata(*args, **kwargs) # ty: ignore[missing-argument] + options = stata(*args, **kwargs) assert options == expected From 9d139ac8ca6b2dec5597605cae57086ae9ff5ee5 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Wed, 31 Dec 2025 12:47:09 +0100 Subject: [PATCH 2/7] fix: tighten exc_info assertion --- tests/test_execute.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_execute.py b/tests/test_execute.py index 1107876..9307756 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -120,7 +120,9 @@ def task_run_do_file(): session = build(paths=tmp_path) assert session.exit_code == ExitCode.FAILED - assert isinstance(session.execution_reports[0].exc_info[1], RuntimeError) # ty: ignore[non-subscriptable] + exc_info = session.execution_reports[0].exc_info + assert exc_info is not None + assert isinstance(exc_info[1], RuntimeError) @needs_stata From 813dff0f818c84624c433a52cc9b681d99d13069 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Wed, 31 Dec 2025 12:49:29 +0100 Subject: [PATCH 3/7] chore: bump ty minimum to 0.0.8 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 91fbb62..9868598 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ test = [ "pytest-cov>=5.0.0", "pytest-xdist>=3.6.1", ] -typing = ["pytask-parallel>=0.5.1", "ty"] +typing = ["pytask-parallel>=0.5.1", "ty>=0.0.8"] [tool.hatch.build.hooks.vcs] version-file = "src/pytask_stata/_version.py" From 697c4468dab443f5bbcb3fc0f6b04113208baff9 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Wed, 31 Dec 2025 12:54:29 +0100 Subject: [PATCH 4/7] chore: add weekly dependabot for uv --- .github/dependabot.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 718572b..6483b1d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,6 @@ version: 2 - updates: - - package-ecosystem: "github-actions" + - package-ecosystem: "uv" directory: "/" schedule: interval: "weekly" From ffd3fd60f067f9d4f6534ce050daab0bd004725f Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Wed, 31 Dec 2025 13:06:59 +0100 Subject: [PATCH 5/7] chore: add github-actions dependabot updates --- .github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6483b1d..c766b7e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,9 @@ version: 2 updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" - package-ecosystem: "uv" directory: "/" schedule: From ce0dae15b94b1c83533e9c8d0e614bbec17d824c Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Wed, 31 Dec 2025 15:42:15 +0100 Subject: [PATCH 6/7] chore: group github-actions dependabot updates --- .github/dependabot.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c766b7e..be4ca53 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,9 +1,14 @@ version: 2 + updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" + groups: + github-actions: + patterns: + - "*" - package-ecosystem: "uv" directory: "/" schedule: From 03593422b4551ab23bcf19475205d7242de93d85 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Wed, 31 Dec 2025 16:57:44 +0100 Subject: [PATCH 7/7] chore: use prek for lint --- justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/justfile b/justfile index 4ea0144..e5caf20 100644 --- a/justfile +++ b/justfile @@ -12,7 +12,7 @@ typing: # Run linting and formatting lint: - uvx --with pre-commit-uv pre-commit run -a + uvx prek run -a # Run all checks (format, lint, typing, test) check: lint typing test