Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ updates:
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/pytask_stata/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
8 changes: 6 additions & 2 deletions src/pytask_stata/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 3 additions & 1 deletion tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down