diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 718572b..be4ca53 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,11 @@ updates: directory: "/" schedule: interval: "weekly" + groups: + github-actions: + patterns: + - "*" + - package-ecosystem: "uv" + directory: "/" + schedule: + interval: "weekly" 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..e5caf20 100644 --- a/justfile +++ b/justfile @@ -8,11 +8,11 @@ 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: - uvx --with pre-commit-uv pre-commit run -a + uvx prek run -a # Run all checks (format, lint, typing, test) check: lint typing test 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" 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 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